New to using re. Search for a number before a string.

Captain Dunsel jonathan.nyquist at gmail.com
Fri Nov 1 17:33:43 EDT 2013


I have a text file that has lines with numbers occasionally appearing right before a person's name.  For example:

COLLEGE:ENROLLMENT:COMPLETED EVALUATIONS:624309FUDD, ELMER

where I want to search for the name "ELMER FUDD" and extract the number right in front of it "608309" when such a number appears but the length of the number is variable and using ?<= in a regular expression will only search for a fixed length.

Any ideas appreciated! 





More information about the Python-list mailing list