Why is this RegEx not working correctly?
3 answers
/^function(\d+)$/
You need to add +
to make \ d (digits) greedy - match as much as possible. (Assuming this is what you want as it will probably match
function(3242345235234235235234234234535325234235235234523)
, and function(55)
Repeats the previous element one or more times. Greedy so that as many items as possible will be matched before attempting permutations with fewer matches of the previous item, up to the point where the previous item is matched only once.
referring to +
+5
a source to share