On Jul 18, 8:33 pm, [EMAIL PROTECTED] wrote: > Hi, > > Hi, > > I am taking a string as an input from the user and it should only > contain the chars:L , M or R > > I tried the folllowing in kodos but they are still not perfect: > > [^A-K,^N-Q,^S-Z,^0-9] > [L][M][R] > [LRM]?L?[LRM]? etc but they do not exactly meet what I need. > > For eg: LRLRLRLRLM is ok but LRLRLRNL is not as it has 'N' .like that. > > regards, > SZ > > The string may or may not have all the three chars.
re.match(r'[LMR]+\Z', your_string) in English: one or more of L, M , or R, followed by the end of the string. -- http://mail.python.org/mailman/listinfo/python-list