javascript - regexp exec internal index doesn't progress if first char is not a match
问题 I need to match numbers that are not preceeded by "/" in a group. In order to do this I made the following regex: var reg = /(^|[^,\/])([0-9]*\.?[0-9]*)/g; First part matches start of the string and anything else except "/", second part matches a number. Everything works ok regarding the regex (it matches what I need). I use https://regex101.com/ for testing. Example here: https://regex101.com/r/7UwEUn/1 The problem is that when I use it in js (script below) it goes into an infinite loop if