|
Posted by Csaba Gabor on 12/16/68 11:50
otrWalter@gmail.com wrote:
> I have a very specific need.
> Too long to get into what and why here (If you please).
Unclear to me what purpose that statement serves. Ie. does it benefit
you to state it?
> I have this test code...
>
> $_str = "testing that'S supposed to work!"; // Notice the CAP 'S, this
> is the key!
>
> $suffixes = "'S";
> $str = preg_replace("/(\\w)($suffixes)\\b/e", '"$1".strtolower("$2")',
> $_str);
> echo $str;
> exit;
>
> It gives me this...
>
> TESTING THAT\'s SUPPOSED TO WORK!
Seems interesting to me, too. Evidently, php assumes that the inner
strings will be single quote delimited and pre escapes the match
strings. To fix, swap the single and double quotes:
'"$1".strtolower("$2")' => "'$1'.strtolower('$2')"
Csaba Gabor from Vienna
Navigation:
[Reply to this message]
|