Regular expression to capture model numbers

Aahz aahz at pythoncraft.com
Wed Apr 22 23:45:03 EDT 2009


In article <1bbafe6d-e3bc-4d90-8a0a-0ca82808b8b9 at d14g2000yql.googlegroups.com>,
 <krishnapostings at gmail.com> wrote:
>
>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.

What isn't working?  Why not just split() on ";"?  You need to define
your problem more precisely if you want us to help.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list