Hi -- On Mon, 16 Jan 2006, Tom Allison wrote: > I'm digging through the Pragmatic Programmers book and had some questions > about regex support. > > Initially they only mention .sub and .gsub. > > If I wanted to write a regex block using additional flags, say something like > this: > s/perl/ruby/igsm > > What that be expressed as: > > "my favorite programming language is perl".gsub(/perl/ism, 'ruby') > > ??? /s turns on SJIS encoding, so you probably don't want that. As for all the multiline matching, etc., /m causes the wildcard dot to match newline characters, like /s in Perl. You don't need an equivalent of Perl's /m because ^ and $ already always match beginning/end of lines. To match beginning/end of string, you use anchors: \A and \z (or \Z to discount a final newline). > What about the 'x' option? What about it? :-) It's there if you want to use it. David -- David A. Black dblack / wobblini.net "Ruby for Rails", from Manning Publications, coming April 2006! http://www.manning.com/books/black