From: Guido van Rossum Date: Fri, 16 Aug 1991 13:24:42 +0000 (+0000) Subject: save match function instead of regexp object X-Git-Tag: v0.9.8~825 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dff84043e4431a3dfec55e386a1f35e76815adee;p=thirdparty%2FPython%2Fcpython.git save match function instead of regexp object --- diff --git a/Lib/grep.py b/Lib/grep.py index 210f9f008a14..767498bd3229 100644 --- a/Lib/grep.py +++ b/Lib/grep.py @@ -4,14 +4,14 @@ import regexp import string def grep(expr, filename): - prog = regexp.compile(expr) + match = regexp.compile(expr).match fp = open(filename, 'r') lineno = 0 while 1: line = fp.readline() if not line: break lineno = lineno + 1 - res = prog.exec(line) + res = match(line) if res: #print res start, end = res[0] diff --git a/Lib/lib-old/grep.py b/Lib/lib-old/grep.py index 210f9f008a14..767498bd3229 100644 --- a/Lib/lib-old/grep.py +++ b/Lib/lib-old/grep.py @@ -4,14 +4,14 @@ import regexp import string def grep(expr, filename): - prog = regexp.compile(expr) + match = regexp.compile(expr).match fp = open(filename, 'r') lineno = 0 while 1: line = fp.readline() if not line: break lineno = lineno + 1 - res = prog.exec(line) + res = match(line) if res: #print res start, end = res[0]