Hi --

On Thu, 21 Dec 2006, Daniel Finnie wrote:

> Joe Peck wrote:
>> Hey, I've got some text in @x and want there to be at least 1 and at
>> most 3 [joe][/joe] pairs, each having at least one character between the
>> beginning [joe] and the ending [/joe].
>> 
>> This is what I have now, and it seems to sometimes work, and sometimes
>> not.
>> 
>> @x.match(/(\[joe\][\s\d\w]+?\[\/joe\]){1,3}/)
>> 
> Why are you doing /[\s\d\w]+?/?  Just use /.+?/.

\d is part of \w, so [\s\w] would be OK.  But . is very different.  It
does not include newline (by default), and *does* include punctuation.


David

-- 
Q. What's a good holiday present for the serious Rails developer?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
    aka The Ruby book for Rails developers!
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)