Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #58327
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'url:pypi': 0.03; 'from:addr:yahoo.co.uk': 0.04; 'lawrence': 0.09; 'occasionally': 0.09; "person's": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:number': 0.09; 'subject:using': 0.09; 'tismer': 0.09; 'python': 0.11; 'appreciated!': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'language': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'appears': 0.22; 'programming': 0.22; 'header:User-Agent:1': 0.23; 'package.': 0.24; 'url:moin': 0.24; 'references': 0.26; 'second': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'lines': 0.31; 'url:wiki': 0.31; 'extract': 0.31; 'file': 0.32; 'front': 0.32; 'text': 0.33; 'url:python': 0.33; 'but': 0.35; 'url:org': 0.36; 'subject:New': 0.37; 'christian': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'future': 0.60; 'length': 0.61; 'new': 0.61; 'numbers': 0.61; 'url:3': 0.61; 'world.': 0.61; "you've": 0.63; 'name': 0.63; 'such': 0.63; 'url:info': 0.73; 'received:2': 0.84; 'subject:Search': 0.84; 'subject:before': 0.84; 'captain': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: New to using re. Search for a number before a string. |
| Date | Sat, 02 Nov 2013 13:31:59 +0000 |
| References | <f241bc01-d10a-433f-b3af-b22d05a603d8@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | host-2-98-203-149.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
| In-Reply-To | <f241bc01-d10a-433f-b3af-b22d05a603d8@googlegroups.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1952.1383399138.18130.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1383399138 news.xs4all.nl 15900 [2001:888:2000:d::a6]:45755 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:58327 |
Show key headers only | View raw
On 01/11/2013 21:33, 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! > As you've had answers here's some references for future use http://docs.python.org/3/howto/regex.html, https://wiki.python.org/moin/RegularExpression and http://www.regular-expressions.info/python.html Also, the new regex package is an alternative to the stdlib re package. It's available from https://pypi.python.org/pypi/regex -- 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 | Next 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