Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Regex matching on anywhere but the beginning or end of a line

by OM_Zen (Scribe)
on Feb 23, 2003 at 01:53 UTC ( #237834=note: print w/ replies, xml ) Need Help??


in reply to Regex matching on anywhere but the beginning or end of a line

Hi ,

my $var = q("string (12" or 1 foot or 1') into 6" MySQL varchar") +; $var =~ s/(?<!^)"(?!$)/""/g; print "[$var]\n"; __END__ ["string (12"" or 1 foot or 1') into 6"" MySQL varchar"]


The look_ahead and look_behind negative assertion on ^ and $ shall do the match only in the other places of the string


Comment on Re: Regex matching on anywhere but the beginning or end of a line
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://237834]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (15)
As of 2014-10-23 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (129 votes), past polls