3 ms·
May I ask why you were using /g with exec? I was confused about what /g did too.
by bellerocky 12y ago
May I ask why you were using /g with exec? I was confused about what /g did too.
- chrismorgan 12y agoI cannot recall the details, but the two were not in close proximity—the exec() was in a different module which was being called from another location with a regular expression from a third location. The /g had never been necessary, as the expression was ^$-bounded; I presume that the person who originally wrote it didn’t know what /g was but had seen it on some other regular expressions about the place (occasionally, just occasionally, reasonably).