I want get match with checking both side expropriation of main match.
var str = 1234 word !!! 5678 another *** 000more)))
get word
and another
console.log(str.match(/(?!\d+\s?)\w+(?=\s?\W+)/g))
>> (3) ["word", "another", "more"]
it check both side but not include in the main match sets.
But in html it not working [not working]
var str = '<a href="url"></a><a href="url2"></a><a href="url3"></a>';
get url
, url2
and url3
console.log(str.match(/(?!href=")[^"]+?(?=")/g))
>> (6) ["<a href=", "url", "></a><a href=", "url2", "></a><a href=", "url3"]
I try to Negative lookarounds using (?!href=")
and Positive lookarounds using (?=")
to match only the value of its attribute but it return more attributes.
Is there any way to so like this here, Thanks