On 29.03.2011 17:11, spir wrote:
On 03/29/2011 02:16 PM, KennyTM~ wrote:
On Mar 29, 11 18:56, bearophile wrote:
Dmitry Olshansky:

Others (except (?P<name>) and (?P=name) ) also considered common extensions and I planed to add them plus regex comment (#...) where all of ... simply
have no effect on matching.

Beside the (#...) comments in Python you have also the verbose regex, that allow to put whispace and free #... comments with no parentheses. I find this
one of the nicest features, because it allows you to format your regex.

Bye,
bearophile

You can also format regex with

r"\d+" // matches the integer part
~ r"(?:\.\d+)?"; // matches the fractional part

:)

Nice trick, thank you!

Or even without '~' using implicit adjacent strings concatenation
(though I vaguely remember that the conclusion was that ~ operator string will also happen at compile time soon)
string pat = `\d+` // matches the integer part
`(?:\.\d+)?`; // matches the fractional part
assert(pat == `\d+(?:\.\d+)?`);

This I think somewhat diminishes the need for verbose regex, isn't it? It may be even documented somewhere in examples... Overall for now it seems that having different syntax style (like perl and etc.) is not something people find useful/interesting.
So I'll be sticking with ECMA + extensions.

--
Dmitry Olshansky

Reply via email to