Regular expression to capture model numbers
krishnapostings at gmail.com
krishnapostings at gmail.com
Wed Apr 22 18:01:29 EDT 2009
My quick attempt is below:
obj = re.compile(r'\b[0-9|a-zA-Z]+[\w-]+')
>>> re.findall(obj, 'TestThis;1234;Test123AB-x')
['TestThis', '1234', 'Test123AB-x']
This is not working.
Requirements:
The text must contain a combination of numbers, alphabets and hyphen
with at least two of the three elements present. I can use it to set
min length using ) {}
Thanks,
Krishna.
More information about the Python-list
mailing list