2 ms·
According to the debugger at http://regex101.com/ http://regex101.com/: /.*(\d)/ - Searches right-to-left, backtracking until it finds the match. /(\d)\D
by claar 12y ago
According to the debugger at http://regex101.com/ http://regex101.com/:
/.*(\d)/
- Searches right-to-left, backtracking until it finds the match.
/(\d)\D*$/
- Searches left-to-right, going forward a step, backtrack, forward, backtrack, until it finds a match.
If you're looking for a match toward the end of a string, the .* version will be faster.
- hamburglar 12y agoWow, regex101.com is very nice, but I never would have noticed that debugger pane if I hadn't gone looking for it after your comment. Incredibly useful tool.