Matches the string with the pattern, caching the compiled regexp.
(pattern, s)
| 655 | |
| 656 | |
| 657 | def Match(pattern, s): |
| 658 | """Matches the string with the pattern, caching the compiled regexp.""" |
| 659 | # The regexp compilation caching is inlined in both Match and Search for |
| 660 | # performance reasons; factoring it out into a separate function turns out |
| 661 | # to be noticeably expensive. |
| 662 | if pattern not in _regexp_compile_cache: |
| 663 | _regexp_compile_cache[pattern] = sre_compile.compile(pattern) |
| 664 | return _regexp_compile_cache[pattern].match(s) |
| 665 | |
| 666 | |
| 667 | def ReplaceAll(pattern, rep, s): |
no test coverage detected
searching dependent graphs…