[Tutor] need help with a regular expression

Kelie kf9150 at gmail.com
Sun Jun 29 03:50:57 CEST 2008


Mark Tolonen <metolone+gmane <at> gmail.com> writes:
> re.compile(r'^_{0,3}[A-Z](?:[A-Z0-9]|-(?!-))*[A-Z0-9]$')   # if rule 4 is an 
> additional letter or digit
> re.compile(r'^_{0,3}[A-Z](?:[A-Z0-9]|-(?!-))*(?<!-)$')       # if 
> single-letter strings are allowed
> 

Mark, single-letter strings are allowed and your regular expression works as
expected. Thank you!







More information about the Tutor mailing list