Tuesday, 15 January 2013

javascript - Regex for all section headers (2.0, 2.1.2, 2.3.1.5, etc) -


I am using something like this

  / (\ w [ ] \ W) + / IIG  

Whatever I do not need to do, I am trying to match the digits before and after any period, any difference

Full answer:

  / ^ \ d + (?: \. \ D +) + $ / Gm  

Thanks everyone! You are all magicians.

Looks like you want a regex like below.

  / ^ \ d + (?: \. \ D +) * $ / m  

(?: \. \ D + ) * repeats the decimal part squared or more often because the above regex number formats such as 9 , 9.9 , 9.9.9 or Will match 9.99


No comments:

Post a Comment