1 # Provide backward compatibility for module "regexp" using "regex".
4 from regex_syntax
import *
7 def __init__(self
, pat
):
8 save_syntax
= regex
.set_syntax(RE_SYNTAX_AWK
)
10 self
.prog
= regex
.compile(pat
)
12 xxx
= regex
.set_syntax(save_syntax
)
13 def match(self
, *args
):
17 str, offset
= args
[0], 0
19 raise TypeError, 'wrong argument count'
20 if self
.prog
.search(str, offset
) < 0:
24 while i
> 0 and regs
[i
-1] == (-1, -1):
35 global cache_pat
, cache_prog
37 cache_pat
, cache_prog
= pat
, compile(pat
)
38 return cache_prog
.match(str)