Tuesday, 3 September 2013

Python Regular Expression -- not matching digits at end of string

Python Regular Expression -- not matching digits at end of string

This will be really quick marks for someone...
Here's my string:
Jan 13.BIGGS.04222 ABC DMP 15
I'm looking to match:
the date at the front (mmm yy) format
the name in the second field
the digits at the end. There could be between one and three.
Here is what I have so far:
(\w{3} \d{2})\.(\w*)\..*(\d{1,3})$
Through a lot of playing around with http://www.pythonregex.com/ I can get
to matching the '5', but not '15'.
What am I doing wrong?

No comments:

Post a Comment