fastpy_rs.textutils
def
regex_search(pattern, text):
Finds all unique matches of a regex pattern in the given text.
This function uses a cached regex engine to improve performance by storing compiled regex patterns. If the cache exceeds 20 entries, it will be cleared to free up memory.
Arguments
pattern- A string slice that holds the regex pattern to search for.text- A string slice that holds the text in which to search for the pattern.
Returns
- A
PyResultcontaining a vector of unique matches as strings. If the pattern is invalid, returns aPyValueErrorwith an appropriate error message.