develooper Front page | perl.fwp | Postings from March 2002

Re: recursive regexps

Thread Previous
From:
Stephen Turner
Date:
March 11, 2002 04:24
Subject:
Re: recursive regexps
Message ID:
Pine.LNX.3.96.1020311122123.24779A-100000@gentoo
On Mon, 11 Mar 2002, F.Xavier Noria wrote:

> I am not familiar with recursive regexps, not to mention their use in
> substitutions (room for playing until next April 1st :-)  Have you find
> situations in everyday code where they apply naturally?  Would the
> secret number problem be solved using a recursive regexp?
> 

Well, I think the canonical example is the problem of matching nested
parentheses. If you have the Camel book, the code and the explanation are
on pages 213-214. And yes, I have actually used this in real life.

I'd be interested to know of other real examples too.

-- 
Stephen Turner, Cambridge, UK    http://homepage.ntlworld.com/adelie/stephen/
"This is Henman's 8th Wimbledon, and he's only lost 7 matches." BBC, 2/Jul/01


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About