I have a regex:
var r = /^(\+?48)?\D*(?:(\d)\D*){9}/gi
Its purpose is to check whether a string contains (at least) 9 digits, mixed randomly with other non-digit characters. And I'm having this:
> r.test(' w3f23ev434r23f2e2323r23r48 12 345 62 89')
true
> r.test(' w3f23ev434r23f2e2323r23r48 12 345 62 89')
false
> r.test(' w3f23ev434r23f2e2323r23r48 12 345 62 89')
true
> r.test(' w3f23ev434r23f2e2323r23r48 12 345 62 89')
false
Why does this happen? Is a regex object instance mutable?