regexp is not what you need then

You will require a character-by-character search/replace

or try:
<?php
$q = "'here's to you'";
print "\$q= $q\n";
$a = addslashes($q);
print "\$a= $a\n";
$z = ereg_replace("\\\'(.*)\\\'","'\\1'",$a);
print "\$z= $z\n";
?>
which produces:

$q= 'here's to you'
$a= \'here\'s to you\'
$z= 'here\'s to you'

-----Original Message-----
From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 11:35 AM
To: Rick Emery
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] regexp for ' replacement


Nop. I don't want to affect the first and last ' of every line.


On Fri, 5 Apr 2002, Rick Emery wrote:

> addslashes($textline)
> 
> -----Original Message-----
> From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 05, 2002 10:54 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] regexp for ' replacement
> 
> 
> Yet another regexpr question.
> 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.
> 
> Make sense for regexpr usage?
> 
> TIA,
> thalis
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to