Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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.


Replies are listed 'Best First'.
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.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://303596]
[Discipulus]: welcome WinnieB, good morning marto
[marto]: good morning all
[Corion]: Good morning ;)
[marto]: meh, that's the last time I reply to finddata, I don't see an improvement in attitude or approach

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2017-03-30 07:00 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (353 votes). Check out past polls.