regular expressions: ignoring certain chars globally

Posted by shi kui on Stack Overflow See other posts from Stack Overflow or by shi kui
Published on 2010-05-19T06:51:30Z Indexed on 2010/05/19 7:00 UTC
Read the original article Hit count: 196

Filed under:
|

Consider it that '_'s in a number doesn't change that number's value so 1000==1_000==10_00.

The Problem: given numbers like 1_244_23 1412_2 1_1111 etc..., how could I decide whether certain number appears in that collection? For example: 1244_23 yes, 11_111 yes, 1412_1 no.

How could using regex to solve this? I mean, if I could tell the regex engine just ignore these '_''s when matching then this problem becomes trivial? How could I do so?

© Stack Overflow or respective owner

Related posts about regex

Related posts about JavaScript