In article
<[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Thalis A. Kalfigopoulos) wrote:
> If I have as part of a text:
> ...and then 'the quick brown fox jumped over the lazy dog's piano'...
>
> How can I substitute the single quote in "dog's" with say \'
> I want to aply a substitution for only the single quote that is between two
> single quotes and leave the rest of the text in between the same.
Does this work for you?
$str="...and then 'the quick brown fox jumped over the lazy dog's
piano'...";
echo $str=preg_replace("/'(.*)'(.*)'/U","'$1\'$2'",$str);
--
CC
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php