Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: I resolve to finally grok and use the regex option...

by ambrus (Abbot)
on Apr 23, 2005 at 13:22 UTC ( [id://450697]=note: print w/replies, xml ) Need Help??


in reply to I resolve to finally grok and use the regex option...

I routinely use g, s, and sometimes even i, e, x, c. I even know what o and m means, but I haven't find any use for them.

However, I am all confused when I write regexen in ruby, because the m option for ruby regexps is the same as the s in perl. Even worse, if you write s by habit, you don't even get a warning because it has a different meaning.

Update 2007 jan 22: since then, I've found a use for m as well.

  • Comment on Re: I resolve to finally grok and use the regex option...

Replies are listed 'Best First'.
Re^2: I resolve to finally grok and use the regex option...
by jhourcle (Prior) on Apr 24, 2005 at 01:08 UTC

    You might not use them because there are other ways to get around them. For instance, with qr//, you don't need to ever use m//o. m//m can be useful when you're trying to read in data records, but you can also match on the line seperator with a lookahead or lookbehind assertion. (or line seperator or \A or \Z, it you might match the very beginning or very end)

Re^2: I resolve to finally grok and use the regex option...
by etcshadow (Priest) on Apr 24, 2005 at 05:20 UTC
    <s>You use /c? What is it, and why can't I find anything about it in perlre?</s>

    Update: never mind. Resolved in the CB. For any others curious, it's in perlop, not perlre.

    ------------ :Wq Not an editor command: Wq
      This was new to me too. I found some additional information on /c in perlretut.

      /c (in conjunction with /g) is great for tokenization. See Using Multiple m/\G.../gc to Tokenize for an example. There's another example in perlfaq.

      I've actually used all of the options listed in the poll.

Log In?
Username:
Password:

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

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

    No recent polls found