Ask a Question related to PERL Miscellaneous, Design and Development.
-
Rodney #1
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
Rodney Guest
-
pattern match
Where can I find infi or doc on "pattern match" used within WHERE clause (mysql). As I need to matche with PHP variables I'd prfer something... -
[ADMIN] Pattern Match
It was Wednesday, December 10, 2003 when Rob Dixon took the soap box, saying: : Before I finally burst my cyanide capsule, may I.. ? No, you may... -
please help !! pattern match
Hi , I need some help me to extract a pattern. The delimiters is a pair of "abcd" and "efgh". Can some one help me with an efficient use of Greedy... -
uninitialized value in pattern match
#!/usr/bin/perl use warnings; use strict "refs"; use strict "subs"; use strict "vars"; our $netscape; $netscape = ($ENV{HTTP_USER_AGENT}... -
Pattern match with 2 conditions
Stephan Bour <sbour@niaid.nih.gov> writes: use strict; # is your friend what's the point of this when you just set it back to "" below? ... -
John W. Krahn #2
Re: Pattern Match Question..
Rodney wrote:
The backslash character is special in double quoted strings so you have>
> 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;
to escape it if you want a literal backslash character.
$TextBlockToConvert =~ s/\\"/"/g;
John
--
use Perl;
program
fulfillment
John W. Krahn Guest
-
Tim Hammerquist #3
Re: Pattern Match Question..
John W. Krahn graced us by uttering:
What this actually does is change all <"> to <">; the <\> is> 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;
ignored.
The left side is right, but I think the OP wanted a <\> in his> 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;
result as well. If that's the case, the following will work:
$block_to_cnvt =~ s#\\"#\\"#g;
or
# uses capturing parens to reduce
# ambiguity in replacement string
$block_to_cnvt =~ s#(\\)"#$1"#g;
HTH,
Tim Hammerquist
--
Last year in Oregon, Summer fell on a *tuesday*.
That was it. One day. Big shiny thing in the sky.
Some people thought it was a UFO.
-- Randal L. Schwartz, comp.lang.perl.misc
Tim Hammerquist Guest
-
Rodney #4
Re: Pattern Match Question..
That did it perlfectly!
Thanks John.
--
....
`·.¸¸.·´¯`·.¸¸.·´¯`·-> rodney
Rodney Guest



Reply With Quote

