Regular expression to exclude HTML tags from text replacement
i need to create a regular expression (in Java) to replace sections of text that are NOT in <span> HTML tags. basically i am replacing a set of terms with a block of text inside span tags, but i don't want the terms inside those blocks of text to be matched as well. so i only want to replace terms that aren't inside <span> tags.
My regular expression so far is:
where $term is the term that i want to replace. basically the regular expression needs to say "search for all instances of $term that are not between an open and end <span> tag (and replace with the defined text)".
please ask if i haven't explained this adequately and i can explain the situation more clearly.
any help would be appreciated,
p.s. i'm not all that good at Regular Expressions, so please excuse the one above ;)
Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.