javascript - Regex to find pattern, return subpattern -
var s = "lala url(ok) tee hee url( oh ya ) kk"; s.match( /url(([^)]+))/g ); from 's' trying extract:
['ok', ' oh ya '] but, getting:
["url(ok", "url( oh ya "] i can iterate on list , remove 'url(', suspect regex-fu can remove too.
in other language regex support lookbehind using regex (?<=url\()(([^)]+))
but unfortunately javascript regex doesn't support lookbehind this example, must iterate it. except don't realy need url word included.
Comments
Post a Comment