Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_extract_regex(regex, text, replace_entities, expected):
assert extract_regex(regex, text, replace_entities) == expected
def re(self, regex, replace_entities=True):
"""
Apply the given regex and return a list of unicode strings with the
matches.
``regex`` can be either a compiled regular expression or a string which
will be compiled to a regular expression using ``re.compile(regex)``.
By default, character entity references are replaced by their
corresponding character (except for ``&`` and ``<``).
Passing ``replace_entities`` as ``False`` switches off these
replacements.
"""
return extract_regex(regex, self.get(), replace_entities=replace_entities)