Re: r' question

2008-05-18 Thread Gabriel Genellina
En Sun, 18 May 2008 02:49:03 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > However, (please refer back to my original post) > I want to keep the fstr, ultimately to be the > string entered by the user who knows a bit about > regex, but not how to use r' ' . Or > alternatively, not assume any

Re: r' question

2008-05-17 Thread Dick Moores
At 10:17 PM 5/17/2008, Gabriel Genellina wrote: En Sat, 17 May 2008 23:37:16 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > I have a text file of phone numbers, which I'd like to search with a regex. > > fstr = "\sjoe\s" > regex = "^.*" + fstr + ".*$" > > fstr = "\sjoe\s" > regex = "r'^.*" +

Re: r' question

2008-05-17 Thread Gabriel Genellina
En Sat, 17 May 2008 23:37:16 -0300, Dick Moores <[EMAIL PROTECTED]> escribió: > I have a text file of phone numbers, which I'd like to search with a regex. > > fstr = "\sjoe\s" > regex = "^.*" + fstr + ".*$" > > fstr = "\sjoe\s" > regex = "r'^.*" + fstr + ".*$'" The r"..." is a signal to the pars

r' question

2008-05-17 Thread Dick Moores
Win XP, Python 2.5.1 I have a text file of phone numbers, which I'd like to search with a regex. This script works fine: import re fstr = "\sjoe\s" regex = "^.*" + fstr + ".*$" p = re.compile(regex, re.I) f = open('phone.txt', 'r') for line in f.readlines():     if p.search(line):     print