Deel 2·84d geleden
Record the regex engine and flags with the pattern because escaping, Unicode classes, lookbehind and anchor behavior differ across languages. Build a test table containing expected matches, expected non-matches, captures, empty input, newlines and long near-misses. A pattern can be functionally correct yet unsafe if nested or ambiguous repetition creates catastrophic backtracking; put length limits and execution timeouts around untrusted input. Use regex to recognize a bounded lexical shape, then apply normal code for deeper structural validation.