in reply to does code help regex match numeric ranges?

In case there's no better way, you can always set some variable that is visible to the outer scope to store capturing groups and to indicate failure.

perlre says This assertion may be used as a "(?(condition)yes-pat-tern|no-pattern)" switch which makes me believe it should be possible let the regex fail (use (?!) as the no-pattern).

I haven't managed it yet, but I'm trying...