Tests a regular expression pattern against a string, guarded against catastrophic backtracking (ReDoS) by running the match in an isolated worker thread with a hard 500ms timeout that fails closed.