-
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 (1,234) 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.
-
-
preg_replace('@(\d),(\d)@', '$1$2', $string);
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks