www.webdeveloper.com
Results 1 to 2 of 2

Thread: Remove Commas from Numbers and Leave Commas between Words

  1. #1
    Join Date
    Nov 2010
    Posts
    18

    Remove Commas from Numbers and Leave Commas between Words

    Dear forum,
    I need to remove commas from numbers and leave commas between words, but I can’t find regular expression that does this. Numbers are always same without whitespace characters, but text can be different (with whitespace characters on both side, on left, on right side of comma, or without white spaces) like:
    one,two
    tree , four
    five, six
    seven ,eight
    Can please somebody help me with this.

  2. #2
    Join Date
    Nov 2010
    Posts
    18
    preg_replace('@(\d),(\d)@', '$1$2', $string);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles