Jump to content
Old threads will finally start getting archived ×

dr3ex

New Members
  • Posts

    2
  • Joined

  • Last visited

dr3ex's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you, but it doesn't work: $str = 'test "first string" test "second string longer" end'; $RegExp = '#[" ]{2,}(\w+)[" ]{2,0}#'; $str = preg_replace($RegExp, '%$1%', $str); // Error line echo $str; Warning: preg_replace() [function.preg-replace]: Compilation failed: numbers out of order in {} quantifier at offset 21 in C:\...\script.php on line Error line
  2. I'm having hard time with PREG_REPLACE. I have this string ($str): test \"first string\" test \"second string longer\" end I need to have: %test%first string%test%second string longer%end% This doesn't work: echo preg_replace('#(")(.*?)(")#i', '%$2%', stripslashes($str)); Result: test %first string% test %second string longer% end Thanks all for help!
×
×
  • 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.