John W. Long wrote:
> A LeDonne wrote:
>>> -A
>> 
>> Better:  re = /(['"])(?:.*\1)(.*\1!)/
> 
> But the point is to match any quoted expression followed by an
> exclamation point. The string:
> 
>    %{ "this looks like "fun"!" }
> 
> Is only to demonstrate an expression that I was having trouble greping.
> Your expression would require a quote and then a quoted expression
> followed by an exclamation point--not exactly what I was looking for.

Ignore my "better". what I had the first time,

re = /(['"])(?:.*\1)*(.*\1!)/

was actually correct. That way, it requires zero or more intervening 
matching quoty things. That's what I get for not writing unit tests 
first...

-A

-- 
Posted via http://www.ruby-forum.com/.