Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: A serch and replace question

by Abigail-II (Bishop)
on Oct 31, 2003 at 16:32 UTC ( #303596=note: print w/ replies, xml ) Need Help??


in reply to A serch and replace question

That's because | is special to the regexp engine, and using hex escapes isn't going to disable that. Try this:

$data =~ s/\x0d\x0a[|][|]/||/g; # No /s needed.

Abigail


Comment on Re: A serch and replace question
Download Code
Re: Re: A serch and replace question
by benizi (Hermit) on Oct 31, 2003 at 18:27 UTC

    Not true. Using -Mre=debug (output trimmed a bit)
    /a|b/ yields:

    Compiling REx `a|b' 1: BRANCH(4) 2: EXACT <a>(7) 4: BRANCH(7) 5: EXACT <b>(7) 7: END(0) minlen 1

    but /a\x7cb/ yields:
    Compiling REx `a\x7cb' 1: EXACT <a|b>(3) 3: END(0) anchored `a|b' at 0 (checking anchored isall) minlen 3

    (tested w/ 5.005_03, 5.6.0, and 5.8.0)
Re: Re: A serch and replace question
by ChuckularOne (Parson) on Oct 31, 2003 at 19:23 UTC
    I figured using Hex escapes would get around that issue. I guess I was wrong. Thanks.

    -Chuckularone

Log In?
Username:
Password:

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

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

    Is guessing a good strategy for surviving in the IT business?





    Results (74 votes), past polls