Regular expression

Peter Fodrek peter.fodrek at stuba.sk
Tue Jul 21 11:51:32 EDT 2009


21.7.2009 v 16:50, MRAB:

> 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*)?)')

Thank you I will try yesterday...

Peter 



More information about the Python-list mailing list