Problems with regular expressions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?iso-8859-1?Q?Carlos_Luis_P=E9rez_Alonso?=

    #1

    Problems with regular expressions

    I have the next piece of code:

    ------------------------------------------------------------------------
    if re.search('^(ta skid|bugid):\\d +',logMessage):
    return 0
    else:
    sys.stderr.writ e("El comentario tiene que contener el taskid:#### o el bugid:####")
    return 1
    -------------------------------------------------------------------------

    The regular exprexión is "^(taskid|bugid ):\\d+"

    Mi problem is that if logMessage == "taskid:234 " the regular expression matched teorically, but the result is always "None" and the function returns 1.

    ¿Does anybody has an idea of what is happening here?

    Thanks
Working...