[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

shorthand notation for multiline in regexps?

Carl Youngblood

10/8/2003 3:08:00 PM

Is there a way to declare a multiline or ignorecase regexp without using
Regexp.new()? I'd like to be able to do something like:

/someregexp/im

or something like that, similar to the way perl allows you to put stuff
after the regexp. I can't find anything about this in Programming Ruby.

Carl Youngblood

1 Answer

Robert Klemme

10/9/2003 8:28:00 AM

0


"Carl Youngblood" <carl@ycs.biz> schrieb im Newsbeitrag
news:cLVgb.521546$Oz4.379040@rwcrnsc54...
> Is there a way to declare a multiline or ignorecase regexp without using
> Regexp.new()? I'd like to be able to do something like:
>
> /someregexp/im
>
> or something like that, similar to the way perl allows you to put stuff
> after the regexp. I can't find anything about this in Programming Ruby.

MY_LONG_COMMENTED_REGEXP = /
(\w+) # given name
\s+
(\w+) # surname
\s+
(\d+) # age
/mix

Reegards

robert