Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Explain output produced by Regexp::Assemble

by polypompholyx (Chaplain)
on Aug 03, 2005 at 08:50 UTC ( #480399=note: print w/replies, xml ) Need Help??


in reply to Explain output produced by Regexp::Assemble

They're the same as the x (extended space-insensitive), i (case insensitive), s (single line, allow . to match \n.), and m (multi line, allow ^ and $ to match around \n) modifiers you can put on the end of a regex m// match.

When you save a modified regex using quote-regex (which Regex::Assemble uses internally), like this $regex = qr/foo/ix, these flags need to be set within the $regex, particularly because you might well incorporate it into a larger quoted regex at some later point, like this: $fwibble = qr/$regex|something_else/. The flags are only in operation for the first part of this new regex, but not for something_else.

The flags ahead of the dash are the ones in operation within the scope of the enclosing parentheses. So (?-xism:foo) means that none of the flags are in operation when trying to match 'foo'. (?misx:foo) would mean all of them are in operation, and (?ix-sm:foo) would mean only i and x were.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://480399]
help
Chatterbox?
[Cosmic37]: I'm wondering whether there is a specific/(or at least "usual") command or does one take a copy before undefining and then copy it back after slurping file into a string?
[BarApp]: I need help accessing perl files. I need permission!!!
[Cosmic37]: I wish thee a peachy life and express gratitude for considering my pathetic questions
[erix]: record separator
[Cosmic37]: Permissions are interesting earthlings. Did nature determine who gives permission and who asks permission. Who was the first to get permission? Are you not related to them as one big earthling family?
[karlgoethebier]: Cojones! We need cojones!
[karlgoethebier]: Ouch! Permissions! We need permissions!

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2017-06-29 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (672 votes). Check out past polls.