On 03/29/2011 12:40 AM, bearophile wrote:
Dmitry Olshansky:

BTW which ones? Now is the time to propose them.

Verbose regular expressions, that allow to put space and comments, to format 
REs more like code and less like a cryptic puzzle language.

(?:...) A non-grouping version of regular parentheses. Matches whatever regular 
expression is inside the parentheses, but the substring matched by the group 
cannot be retrieved after performing a match or referenced later in the pattern.

(?P<name>...) Similar to regular parentheses, but the substring matched by the 
group is accessible via the symbolic group name name. A symbolic group is also a 
numbered group.

(?P=name) Matches whatever text was matched by the earlier group named name.

(?=...) Lookahead assertion. Matches if ... matches next, but doesn't consume 
any of the string.

(?!...) Negative lookahead assertion. Matches if ... doesn't match next. The 
contained pattern must only match strings of some fixed length.

(?<=...) Positive lookbehind assertion. Matches if the current position in the 
string is preceded by a match for ... that ends at the current position. The 
contained pattern must only match strings of some fixed length.

(?<!...) Negative lookbehind assertion. Matches if the current position in the 
string is not preceded by a match for .... The contained pattern must only match 
strings of some fixed length. Patterns which start with negative lookbehind 
assertions may match at the beginning of the string being searched.

FWIW: (probably due to domain?) I have never used positive lookahead, and even less lookbehinds. Also, what I like in py regexes is that they don't match anywhere as default (there is a find method). What I find annoying is single-line-only as default (like D regexes, unfortunately).

Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to