One more regular expressions question

Daniele Varrazzo daniele.varrazzo at
Thu Jan 18 14:06:48 CET 2007

Victor Polukcht wrote:
> Great thanks.
> You post helped me so much!
> My resulting regexp is:
> "(?P<var1>^(.*)\s*)\(((?P<var2>\d+))\)\s+((?P<var3>\d+))"

Notice that this way you are including trailing whitespaces in the var1
group. You may want to put the "\s*" outside the parenthesis.

mmm... in this case you should make the ".*" in the first group
non-greedy. r"^(?P<var1>.*?)\s*\(((?P<var2>\d+))\)\s+((?P<var3>\d+))"
does the job.



More information about the Python-list mailing list