Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Regex doubt

by aukjan (Friar)
on Jul 29, 2005 at 07:54 UTC ( [id://479270]=note: print w/replies, xml ) Need Help??


in reply to Regex doubt

$line =~ s/TelecommuterTrac(\\)?WebIntHitList3/country/;


Update: Do substitution on both single and double quoted lines
;-)

Replies are listed 'Best First'.
Re^2: Regex doubt
by Anonymous Monk on Jul 29, 2005 at 08:36 UTC
    That will leave $line unchanged, as it will change a string consisting of TelecommuterTrac followed by a backslash, followed by WebIntHitList3 to country. But $line was assigned "TelecommuterTrac\WebIntHitList3" which does not contain a backslash. It's in double quoted context, and the backslash is escaping the W from its special meaning (which it doesn't have). So, $line equals TelecommuterTracWebIntHitList3.
      That depends - the OP may have originally been presented with a problem in which the backslash was there but is losing the backslash during the testing process to try to fix the (wrong) problem.

      One world, one people

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-25 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found