PHP Regex: Can I put an end of string $ in a range? -
can put end of string character in range this:
$string=preg_replace('/([a-z])([ \,$])/','$2',$string); so matches lowercase letter, either space, comma or end of string?
you can use alternation:
([ ,]|$) if use $ inside character class matches literal dollar sign.
Comments
Post a Comment