Hello Campers,
I’m reading more about the regular expressions on javascript info and could you please confirm the following to me. There is a text:
That’s exactly because
regexp.lastIndexis non-zero on the second test.
To work around that, one could use non-global regexps or re-adjustregexp.lastIndex=0before a new search.
Link: Methods of RegExp and String (scroll to the very end, just before the summary)
Does it mean in order to get around the described issue the variable to which the regexp should be saved must be a local one but not a global, isn’t it?
Thanks!
