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
, str, offset
= 0):
14 if self
.prog
.search(str, offset
) < 0:
18 while i
> 0 and regs
[i
-1] == (-1, -1):
29 global cache_pat
, cache_prog
31 cache_pat
, cache_prog
= pat
, compile(pat
)
32 return cache_prog
.match(str)