javascript - Repeated regular expression match -


i have string consists exclusively of numbers. want match groups of 3 of every digit excluding first digit.

for example: "1000123" should return "000" , "123" matches.

i tried using

/\d(\d{3})+/ 

but matches first group being "000" , global flag didn’t either.

how solve this?

use negative lookahead. 3 digits.

(?!^\d)\d{3} 

demo

or

from 1 upto 3 digits.

(?!^\d)\d{1,3} 

Comments

Popular posts from this blog

javascript - Create websocket without connecting -

how to do line continuation in perl debugger for entering raw multi-line text (EOT)? -

Android SDK Manager freezes after installation of OSX 10.11 El Capitan public Beta -