> You can't. Mathematical expressions make use of nested brackets. Regexps
> don't have the power to handle arbitrarily nested constructs.
Interestingly, I was informed some time ago that modern Perl regular
expressions CAN do so... suggesting that perhaps in the name of
correctness, Perl programmers ought to stop calling them "regular
expressions" and start calling them "context-free expressions". Java,
though, does not include the Perl madness that makes this possible. To
quote from the API docs:
Perl constructs not supported by this class:
[...]
The embedded code constructs (?{code}) and (??{code}),

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Chris Uppal - 01 Dec 2005 18:24 GMT
> Interestingly,
Yes, it /is/ interesting. I could find other adjectives, though.
> I was informed some time ago that modern Perl regular
> expressions CAN do so... suggesting that perhaps in the name of
> correctness, Perl programmers ought to stop calling them "regular
> expressions" and start calling them "context-free expressions".
I suggest the name "aggregations of ill-considered hacks".
> The embedded code constructs (?{code}) and (??{code}),
Ugggh!
Is it possible to write a device driver in Perl regexps yet ?
-- chris
Oliver Wong - 01 Dec 2005 22:09 GMT
> Interestingly, I was informed some time ago that modern Perl regular
> expressions CAN do so... suggesting that perhaps in the name of
> correctness, Perl programmers ought to stop calling them "regular
> expressions" and start calling them "context-free expressions".
From what I understand, Perl's implementation of "regular expression"
allows for arbitrary back-references. If this is true, then the expressive
power of these expressions is greater than context-free languages as well,
so "context-free expressions" would also be a misnomer.
Maybe something like "Turing expressions", though so many things are
named after Alan Turing already that I wouldn't be surprised if "Turing
expressions" already has some other meaning.
- Oliver
Alan Moore - 02 Dec 2005 00:51 GMT
>From the Wikipedia link above:
"'[R]egular expressions' [...] are only marginally related to real
regular expressions. Nevertheless, the term has grown with the
capabilities of our pattern matching engines, so I'm not going to try
to fight linguistic necessity here. I will, however, generally call
them "regexes" (or "regexen", when I'm in an Anglo-Saxon mood)."