Regular expression
MRAB
python at mrabarnett.plus.com
Tue Jul 21 10:50:15 EDT 2009
Peter Fodrek wrote:
> Dear conference!
>
> I have third party regular expression
>
> self.pattern_main = re.compile('(\s+|\w(?:[+])?\d*(?:\.\d*)?|\w\#\d+|\(.*?\)|
> \#\d+\=(?:[+])?\d*(?:\.\d*)?)')
>
[snip]
> It handles file correctly with two exceptions
>
> 1) omits ',' in the a output
> 2) omits minus sign in the numbers...
>
> Would anyone recommend me what to change regular expression to add thesee two
> think to the output,please?
>
self.pattern_main =
re.compile(r'(\s+|,|-?\w\+?\d*(?:\.\d*)?|\w#\d+|\(.*?\)|#\d+=\+?\d*(?:\.\d*)?)')
More information about the Python-list
mailing list