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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -