Re: Finding # prefixing numbers

2005-07-19 Thread Caleb Hattingh
You really owe it to yourself to try the PyParsing package, if you have to do this kind of thing with any frequency. The syntactic difference between PyParsing and regular expressions is greater than the syntactic difference between Python and C. thx Caleb On Tue, 19 Jul 2005 13:35:02 +0200,

Re: Finding # prefixing numbers

2005-07-19 Thread [EMAIL PROTECTED]
Thank you! That solved my problem. -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding # prefixing numbers

2005-07-19 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > In a text that contains references to numbers like this: #583 I want > to find them with a regular expression but I'm having problems with > the hash. Hopefully this code explains where I'm stuck: > import re re.compile(r'\b(\d\d\d)\b').findall('#123 x (#234)

Finding # prefixing numbers

2005-07-19 Thread [EMAIL PROTECTED]
In a text that contains references to numbers like this: #583 I want to find them with a regular expression but I'm having problems with the hash. Hopefully this code explains where I'm stuck: >>> import re >>> re.compile(r'\b(\d\d\d)\b').findall('#123 x (#234) or:#456 #6789') ['123', '234', '456'