Eric Hodel
11/21/2007 12:58:00 AM
On Nov 18, 2007, at 17:55 , Wayne Magor wrote:
> I understand regular expressions, but can someone please explain this:
>
> re = %r/((?<pg>\((?:\\[()]|[^()]|\g<pg>)*\)))/
>
> By the way, this only works with the Oniguruma engine (Ruby 1.9).
>
> So, now that there is the capability to match balanced parens and so
> forth, does this mean that the new regular expression engine can be
> used to construct simple parsers (matching language constructs)?
No, translated to 1.8, the regex would be:
%r/((\((?:\\[()]|[^()]|\2)*\)))/
--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars