Consider the following text:
var t="asdf t1 : v1 xasdf dfas sdf t2 : v2 asdfad t3 : v3 adsfasdf t4 : v4";
How I can use regular expression to retrive values by its title?
I am looking for a solution like following:
t.match(/ ??? t2 ??? /); //should return v2
What about:
t.match(/t2\s*:\s*(\w+)/)[1]?