4 ms·
Python's re.VERBOSE let you write [1] a = re.compile(r"""\d + # the integral part \. # the decimal point
by tzury 13y ago
Python's re.VERBOSE let you write [1]
a = re.compile(r"""\d + # the integral part
\. # the decimal point
\d * # some fractional digits""", re.X)
Instead of
a = re.compile(r"\d+\.\d*")
But that is as far as it goes for me. From that point, masking REGEX with additional layer of 10's of functions is not a wise move.
[1] http://docs.python.org/2/library/re.html#re.VERBOSE http://docs.python.org/2/library/re.html#re.VERBOSE
- btucker 13y agoRuby & Perl use /x to ignore whitespace & comments like this. eg. /\d+ # some comment \w # another comment /x
- krainboltgreene 13y agoIt's not meant for simple regex like that. It's meant for complex composed regular expressions.
- drdaeman 13y agoSeems that most languages with built-in regexes lack any operation on them (like `/foo/ + /bar/` or `/foo/ | /bar/`). I'd blame the standard library, not praise a third-party one.