Matches the string with the pattern, caching the compiled regexp.
(pattern, s)
| 1027 | |
| 1028 | |
| 1029 | def Match(pattern, s): |
| 1030 | """Matches the string with the pattern, caching the compiled regexp.""" |
| 1031 | # The regexp compilation caching is inlined in both Match and Search for |
| 1032 | # performance reasons; factoring it out into a separate function turns out |
| 1033 | # to be noticeably expensive. |
| 1034 | if pattern not in _regexp_compile_cache: |
| 1035 | _regexp_compile_cache[pattern] = sre_compile.compile(pattern) |
| 1036 | return _regexp_compile_cache[pattern].match(s) |
| 1037 | |
| 1038 | |
| 1039 | def ReplaceAll(pattern, rep, s): |
no outgoing calls
no test coverage detected