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

Popular posts from this blog

php - Extract Text from HTTP referer -

Receive udp packets in android gstreamer -

authentication - ASP.NET Core 1.0. Bearer Token, cannot access custom claims -