Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Pattern Match Question.. (http://www.velocityreviews.com/forums/t882472-pattern-match-question.html)

Rodney 09-13-2003 10:35 PM

Pattern Match Question..
 
I want to replace all instances of the combination of \" with \"

Using the Regex code below, I end up replacing ALL " with &guot; and all
\" with \&guot;
How can I make it ONLY replace the combination of \" ?

$TextBlockToConvert =~ s/\"/\quot;/g;

NOTE:
The combination of \" may or may not have other characters butting up
against either or both sides of it.


Thanks,
--
....
`·.¸¸.·´¯`·.¸¸.·´¯`·-> rodney



John W. Krahn 09-13-2003 10:49 PM

Re: Pattern Match Question..
 
Rodney wrote:
>
> I want to replace all instances of the combination of \" with \"
>
> Using the Regex code below, I end up replacing ALL " with &guot; and all
> \" with \&guot;
> How can I make it ONLY replace the combination of \" ?
>
> $TextBlockToConvert =~ s/\"/\quot;/g;


The backslash character is special in double quoted strings so you have
to escape it if you want a literal backslash character.

$TextBlockToConvert =~ s/\\"/"/g;



John
--
use Perl;
program
fulfillment

Rodney 09-14-2003 09:46 AM

Re: Pattern Match Question..
 
That did it perlfectly!

Thanks John.
--
....
`·.¸¸.·´¯`·.¸¸.·´¯`·-> rodney




All times are GMT. The time now is 01:05 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57