I am trying to run regex on a string something like
string = 'The value is ij35dss. The value is fsd53fdsfds.'
Where I want something like string.match(/The value is (.*?)\./g);
to return just ['ijdss','fsdfdsfds'] and not ['The value is ijdss.', 'The value is fsdfdsfds.']
Use
RegExp.execinstead, here’s a sample:and a jsFiddle:
If you think you will need this often, you can add this to a String.prototype:
jsFiddle:
Credits: