On Jul 19, 12:04 pm, Andrew Freeman <[EMAIL PROTECTED]> wrote: > To show if valid: > > if re.search(r'^[LRM]*$', 'LM'): > print 'Valid' >
A couple of points: (1) Instead of search(r'^blahblah', ...) use match(r'blahblah', ...) (2) You need to choose your end-anchor correctly; your pattern is permitting a newline at the end: >>> re.search(r'^[LRM]*$', 'LM\n') <_sre.SRE_Match object at 0x00B9E528> >>> -- http://mail.python.org/mailman/listinfo/python-list