I am trying to search for an expression (var exp = "foo"
) in a big stringText
that includes exp
*but excludes everything starting with '<' and ends with '>'
right now I know how to write it like this:
var regexp = new RegExp(exp, 'g');
match = regexp.exec(stringText)
How do I write the exclude condition?
I know it should be /<.+>/g
but how do I combine it? I know this isn't right but how do I do it?
var regexp = new RegExp(exp + /<.+>/, 'g');
thanks, Alon
== UPDATE ===
I want to search for 'a' inside this string:
"a dog <span class="something"> had a </span> and a cat"
I want it to hit the first 'a', the 'a' inside 'had', the 'a' after that and the 'a' in 'and' 'a' 'cat'
I dont want to get 'a' in 'span' or 'class' or everthing inside <>