Fix issue where smatch wasn't honouring match.ANY. Consolidate repeated logic by using switch/case instead of else ifs for matching
Compare regexes by source and flags instead of valueOf()
ensure NaN matches correctly