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

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -