string = 'Hello 1234_ world 4567_ trap 456';
I need to write down all the numbers followed by the underscore. The following code will do.
string.match(/(\d+?)(_)/gi);
However, I tested the following code and it worked, except that the underscore was also fixed.
(\d+)_
So I decided to emphasize my own capture group, like this
(\ d +) (_)
But that did not work. I get numbers with a final underscore. I do not want to stress.
source share