Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Proper use of //x

by gaspodethewonderdog (Monk)
on Nov 30, 2000 at 20:15 UTC ( [id://44157]=note: print w/replies, xml ) Need Help??


in reply to Proper use of //x

Well in a lot of cases //x isn't useful... *but*...
$s =~ /(AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA| BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB| CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC)/x;
I've personally had horrendously huge regex's that either were going to be about 3,000 characters on one line or I had to break them up to multiple lines. /x is the only way you can do this without picking up spurious white space and carriage returns and still make things look nice. yes you have to escape any spaces you have, but that's the price you have to pay for readability and maintainability sometimes!

Replies are listed 'Best First'.
Re: Re: Proper use of //x
by Fastolfe (Vicar) on Nov 30, 2000 at 20:16 UTC
    Personally, I find \s works just as nicely as a space, and is far more consistent with other regex symbols. Is that what you meant by "escape any spaces"?

Log In?
Username:
Password:

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

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

    No recent polls found