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

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -