Re: How to escape # hash character in regex match strings

2009-06-14 Thread Lie Ryan
Brian D wrote: > On Jun 11, 9:22 am, Brian D wrote: >> On Jun 11, 2:01 am, Lie Ryan wrote: >> >> >> >>> 504cr...@gmail.com wrote: I've encountered a problem with my RegEx learning curve -- how to escape hash characters # in strings being matched, e.g.: >>> string = re.escape('123#ab

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Tim Chase
I'm surprised it's been so difficult to find an example of the hash character in a RegEx string -- for exactly this type of situation, since it's so common in the real world that people want to put a pound symbol in front of a number. It's a character with no special meaning to the regex engine,

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Rhodri James
On Thu, 11 Jun 2009 15:22:44 +0100, Brian D wrote: I'm surprised it's been so difficult to find an example of the hash character in a RegEx string -- for exactly this type of situation, since it's so common in the real world that people want to put a pound symbol in front of a number. It's a

Re: How to escape # hash character in regex match strings

2009-06-11 Thread 504cr...@gmail.com
On Jun 11, 2:01 am, Lie Ryan wrote: > 504cr...@gmail.com wrote: > > I've encountered a problem with my RegEx learning curve -- how to > > escape hash characters # in strings being matched, e.g.: > > string = re.escape('123#abc456') > match = re.match('\d+', string) > print match > >

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Brian D
On Jun 11, 9:22 am, Brian D wrote: > On Jun 11, 2:01 am, Lie Ryan wrote: > > > > > 504cr...@gmail.com wrote: > > > I've encountered a problem with my RegEx learning curve -- how to > > > escape hash characters # in strings being matched, e.g.: > > > string = re.escape('123#abc456') > >

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Brian D
On Jun 11, 2:01 am, Lie Ryan wrote: > 504cr...@gmail.com wrote: > > I've encountered a problem with my RegEx learning curve -- how to > > escape hash characters # in strings being matched, e.g.: > > string = re.escape('123#abc456') > match = re.match('\d+', string) > print match > >

Re: How to escape # hash character in regex match strings

2009-06-11 Thread Lie Ryan
504cr...@gmail.com wrote: > I've encountered a problem with my RegEx learning curve -- how to > escape hash characters # in strings being matched, e.g.: > string = re.escape('123#abc456') match = re.match('\d+', string) print match > > <_sre.SRE_Match object at 0x00A6A800> pri

RE: How to escape # hash character in regex match strings

2009-06-10 Thread David Shapiro
Subject: Re: How to escape # hash character in regex match strings 504cr...@gmail.com wrote: > I've encountered a problem with my RegEx learning curve -- how to > escape hash characters # in strings being matched, e.g.: > >>>> string = re.escape('123#abc456')

Re: How to escape # hash character in regex match strings

2009-06-10 Thread Peter Otten
504cr...@gmail.com wrote: > I've encountered a problem with my RegEx learning curve -- how to > escape hash characters # in strings being matched, e.g.: > string = re.escape('123#abc456') match = re.match('\d+', string) print match > > <_sre.SRE_Match object at 0x00A6A800> pr