Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58356
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: New to using re. Search for a number before a string. |
| Date | 2013-11-03 00:27 +0000 |
| References | <f241bc01-d10a-433f-b3af-b22d05a603d8@googlegroups.com> <981273cf-2c82-4b58-b2d0-5f1beb0b0c53@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1963.1383438482.18130.python-list@python.org> (permalink) |
On 03/11/2013 00:19, Captain Dunsel wrote: > On Friday, November 1, 2013 5:33:43 PM UTC-4, Captain Dunsel wrote: >> 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! > > Thanks for your help, everyone! > My invoice, like the proverbial cheque, is in the post :) Slight aside, in order to avoid the unwanted newlines above could you please read and action this, thanks https://wiki.python.org/moin/GoogleGroupsPython -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
New to using re. Search for a number before a string. Captain Dunsel <jonathan.nyquist@gmail.com> - 2013-11-01 14:33 -0700
Re: New to using re. Search for a number before a string. MRAB <python@mrabarnett.plus.com> - 2013-11-01 21:40 +0000
Re: New to using re. Search for a number before a string. Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-11-02 09:06 +0200
Re: New to using re. Search for a number before a string. Justin Barber <jbarber@iliff.edu> - 2013-11-02 06:03 -0700
Re: New to using re. Search for a number before a string. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-02 13:31 +0000
Re: New to using re. Search for a number before a string. Captain Dunsel <jonathan.nyquist@gmail.com> - 2013-11-02 17:19 -0700
Re: New to using re. Search for a number before a string. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-03 00:27 +0000
csiph-web