in reply to Re: regexp help -- grab almost a whole string
in thread regexp help -- grab almost a whole string

I think I did similar mistake while designing new test system at work. The assumption was, that every value can be tested and checked with a regexp.

$regexp = ...; if($value !~ /$regexp/) { $err .= "wrong value ($value)" }

Everything was fine. And then came the issue with integer range, i.e. value must be integer between 0 and 12800... Now I think about redesigning the engine to accept sub reference instead of regexp:

$subref = ...; if(! &$subref($value)) { $err .= "wrong value ($value)" }

because the only reasonable way of fixing it is to abandon assumption about "regexp can match even the universe" (pity, I like regexps...)