This adds an extra regex eval in a hot code path. I wonder if that's a real perf issue and if memoization would help.