I am looking for an alternative for this:
(?<=.dd)d
(Match third digit after a period.)
I'm aware I can solve it by using other methods, but I have to use a regular expression and more importantly I have to use replace on the string, without adding a callback.
Turn the lookbehind in a consuming pattern and use a capturing group:
And use it as shown below:
var s = "some string.005"; var rx = /.dd(d)/; var m = s.match(/.dd(d)/); if (m) { console.log(m[1]); }
2.1m questions
2.1m answers
60 comments
57.0k users