Saturday, 10 August 2013

Reflex to find pattern, return subpattern

Reflex to find pattern, return subpattern

var s = "lala url(ok) tee hee url( oh ya ) kk";
s.match( /url(([^)]+))/g );
From 's' I am trying to extract:
['ok', ' oh ya ']
but, getting:
["url(ok", "url( oh ya "]
I can iterate over that list and remove the 'url(', but I suspect some
regex-fu can remove it too.

No comments:

Post a Comment