In Javascript:
I have a sentence “this is a test123” and i need to match the group of numbers following the word test.
Is there a way to do this other than with using groups?
This is what i got, but i’d like to make this work without using a group (if possible)
var str = str.match(/test.([0-9]{1,3})/)
Basically i just need to say “any number group preceded by ‘test'”
Simple single line of code (yet groups, but simple):
Or another version with
match:And one more single line without regex: