On Thu, 09 Aug 2007 05:58:22 -0700, shahargs wrote: > I'm looking for the best way to check if regular expression return > true (it's mean - there is a match). for example, i want "if" that > check if this regular expression: .*born.*to.* has a match. > > What's the way to do that simply?
Simply use an ``if`` on the result of the search or match. If the regular expression doesn't match `None` is returned, which is `False` in a boolean context, otherwise a match object is returned, which is `True` in a boolean context. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list