BuckRegex
Type created by the regex function.
BuckRegex.match
def BuckRegex.match(
str: str,
/,
) -> bool
Determine if the regex matches any substring of the given string.
BuckRegex.replace_all
def BuckRegex.replace_all(
haystack: str,
replacement: str,
/,
) -> str
Replace all matches of the regex in the given string with the replacement string. Takes the following parameters: * haystack - The string you will be regex matching against * replacement - The replacement string to replace the regex matches with
Returns a new string with all regex matches replaced.
Sample usage:
regex_pattern = regex(r"foo")
result = regex_pattern.replace_all("foo bar foo", "baz")
result equals "baz bar baz" in this example