Jump to content

preg replace not working


newb

Recommended Posts

$text = preg_replace('{-(\d+)}e', '-convertNumber("$1")', $text); 

 

i have strings im trying to replace like this:

 

name-2 > name-two

name-p2 > name-p2

 

im trying to match and replace the first one and basically ignore the second one. ive included the hyphen in the code. so why isnt this working?

Link to comment
https://forums.phpfreaks.com/topic/209911-preg-replace-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.