Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: better way to escape escapes

by kcott (Abbot)
on Apr 16, 2014 at 03:00 UTC ( #1082417=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $any_slash_or_at = qr{ [\\@] }x;
    
  2. or download this
    s/(?<![\\\@])[\\\@]\@/\x11/g;
    s/(?<![\\\@])[\\\@]\\/\x12/g;
    
  3. or download this
    s/$slash_or_at__at/DC1/g;
    s/$slash_or_at__slash/DC2/g;
    
  4. or download this
    #!/usr/bin/env perl -l
    
    ...
    print;
    s/$escape_slash_or_at/$replace{$1}/g;
    print;
    
  5. or download this
    Testing your code:
    \\\ \\@ \@\ \@@ @\\ @\@ @@\ @@@ \\ \@ @\ @@ \ @
    ...
    Testing simultaneous replacements:
    \\\ \\@ \@\ \@@ @\\ @\@ @@\ @@@ \\ \@ @\ @@ \ @
    DC2\ DC2@ DC1\ DC1@ DC2\ DC2@ DC1\ DC1@ DC2 DC1 DC2 DC1 \ @
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (14)
As of 2014-09-19 11:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (135 votes), past polls