Javascript regex 101: String.test() Jun 10, 2010 return !/D/.test(number); } Basically: /regex/.test("hits regexes") returns true.