On Feb 13, 1:53 pm, mathieu <[EMAIL PROTECTED]> wrote: > I do not understand what is wrong with the following regex expression. > I clearly mark that the separator in between group 3 and group 4 > should contain at least 2 white space, but group 3 is actually reading > 3 +4 > > Thanks > -Mathieu > > import re > > line = " (0021,xx0A) Siemens: Thorax/Multix FD Lab Settings > Auto Window Width SL 1 " > patt = re.compile("^\s*\(([0-9A-Z]+),([0-9A-Zx]+)\)\s+([A-Za-z0-9./:_ > -]+)\s\s+([A-Za-z0-9 ()._,/#>-]+)\s+([A-Z][A-Z]_?O?W?)\s+([0-9n-]+)\s* > $") > m = patt.match(line) > if m: > print m.group(3) > print m.group(4)
I don't know if it solves your problem, but if you want to match a dash (-), then it must be either escaped or be the first element in a character class. Gerard -- http://mail.python.org/mailman/listinfo/python-list