Re: [Tutor] Regular expressions question

2012-12-06 Thread Albert-Jan Roskam
___ From: eryksun eryk...@gmail.com To: Ed Owens eowens0...@gmx.com Cc: tutor@python.org tutor@python.org Sent: Thursday, December 6, 2012 3:08 AM Subject: Re: [Tutor] Regular expressions question On Wed, Dec 5, 2012 at 7:13 PM, Ed Owens eowens0...@gmx.com wrote

Re: [Tutor] Regular expressions question

2012-12-06 Thread Steven D'Aprano
On 06/12/12 20:53, Albert-Jan Roskam wrote: Lately I started using named groups (after I didn't understand some of my own regexes I wrote several months earlier). Months? I can't understand my own regexes about six seconds after I look away from the screen. The downside is that the

Re: [Tutor] Regular expressions question

2012-12-06 Thread Mark Lawrence
On 06/12/2012 11:31, Steven D'Aprano wrote: On 06/12/12 20:53, Albert-Jan Roskam wrote: Lately I started using named groups (after I didn't understand some of my own regexes I wrote several months earlier). Months? I can't understand my own regexes about six seconds after I look away from

[Tutor] Regular expressions question

2012-12-05 Thread Ed Owens
str(string) '[div class=wx-timestamp\ndiv class=wx-subtitle wx-timestampUpdated: Dec 5, 2012, 5:08pm EST/div\n/div]' m = re.search(':\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)', str(string)) print m None I'm sort of embarrassed to ask this, but I've been staring at this regular expression

Re: [Tutor] Regular expressions question

2012-12-05 Thread Brett Ritter
On Wed, Dec 5, 2012 at 4:13 PM, Ed Owens eowens0...@gmx.com wrote: str(string) '[div class=wx-timestamp\ndiv class=wx-subtitle wx-timestampUpdated: Dec 5, 2012, 5:08pm EST/div\n/div]' m = re.search(':\b(\w+\s+\d+,\s+\**d+,\s+\d+:\d+.m\s+\w+)', str(string)) print m None It starts with

Re: [Tutor] Regular expressions question

2012-12-05 Thread Ed Owens
On 12/5/12 7:24 PM, Brett Ritter wrote: On Wed, Dec 5, 2012 at 4:13 PM, Ed Owens eowens0...@gmx.com mailto:eowens0...@gmx.com wrote: str(string) '[div class=wx-timestamp\ndiv class=wx-subtitle wx-timestampUpdated: Dec 5, 2012, 5:08pm EST/div\n/div]' m =

Re: [Tutor] Regular expressions question

2012-12-05 Thread Alan Gauld
On 06/12/12 00:13, Ed Owens wrote: str(string) '[div class=wx-timestamp\ndiv class=wx-subtitle wx-timestampUpdated: Dec 5, 2012, 5:08pm EST/div\n/div]' m = re.search(':\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)', str(string)) print m None I'm sort of embarrassed to ask this, but I've been

Re: [Tutor] Regular expressions question

2012-12-05 Thread Alan Gauld
On 06/12/12 00:24, Brett Ritter wrote: '[div class=wx-timestamp\ndiv class=wx-subtitle wx-timestampUpdated: Dec 5, 2012, 5:08pm EST/div\n/div]' m = re.search(':\b(\w+\s+\d+,\s+\__d+,\s+\d+:\d+.m\s+\w+)', It starts with : which doesn't appear in your string. At the end of

Re: [Tutor] Regular expressions question

2012-12-05 Thread Brett Ritter
On Wed, Dec 5, 2012 at 5:04 PM, Ed Owens eowens0...@gmx.com wrote: m = re.search(':\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)', str(string)) print m None Okay, without the double-quote (it wasn't the colon that I was worried about, it was the double-quote), I believe the issue now is that

Re: [Tutor] Regular expressions question

2012-12-05 Thread eryksun
On Wed, Dec 5, 2012 at 7:13 PM, Ed Owens eowens0...@gmx.com wrote: str(string) '[div class=wx-timestamp\ndiv class=wx-subtitle wx-timestampUpdated: Dec 5, 2012, 5:08pm EST/div\n/div]' m = re.search(':\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)', str(string)) print m None You need a raw string

[Tutor] regular expressions question

2006-08-12 Thread nimrodx
Hi All, I am trying to fish through the history file for the Konquerer web browser, and pull out the web sites visited. The file's encoding is binary or something Here is the first section of the file:

Re: [Tutor] regular expressions question

2006-08-12 Thread Alan Gauld
The file's encoding is binary or something Here is the first section of the file: '\x00\x00\x00\x02\xb8,\x08\x9f\x00\x00z\xa8\x00\x00\x01\xf4\x00\x00\x01\xf4\x00\x00\x00t\x00f\x00i\x00l\x00e\x00:\x00/\x00h\x00o\x00m\x00e\x00/\x00a\x00l' Does that tell you anything? Recall that on a 32 bit

Re: [Tutor] regular expressions question]

2006-08-12 Thread nimrodx
Hi Alan and other Gurus, if you look carefully at the string below, you see that in amongst the \x stuff you have the text I want: z tfile://home/alpha which I know to be an address on my system, plus a bit of preceeding txt. Alan Gauld wrote: The file's encoding is binary or something Here is