Matches the string with the pattern, caching the compiled regexp.
(pattern, s)
| 644 | |
| 645 | |
| 646 | def Match(pattern, s): |
| 647 | """Matches the string with the pattern, caching the compiled regexp.""" |
| 648 | # The regexp compilation caching is inlined in both Match and Search for |
| 649 | # performance reasons; factoring it out into a separate function turns out |
| 650 | # to be noticeably expensive. |
| 651 | if pattern not in _regexp_compile_cache: |
| 652 | _regexp_compile_cache[pattern] = sre_compile.compile(pattern) |
| 653 | return _regexp_compile_cache[pattern].match(s) |
| 654 | |
| 655 | |
| 656 | def ReplaceAll(pattern, rep, s): |
no outgoing calls
no test coverage detected