> Here, I want to replace text "table" to "<strong>table</strong>", but not inside the html tag but only text "table". how can i do it with regex?
Hmm, negative character class might work, esp. if you're asking for a specific
word like table (perl-ish):
s#[^<]/?table\b#<strong>table</strong>#g
any char not a left pointy, zero or one backslash (to handle both start and end tags), "table", a word border (so's not to match "tabletennis" - I used "#" to avoid the leaning toothpick syndrome.
But the general answer is - don't try to parse html by hand, get a module/util to do it. It very, very, very quickly becomes very, very hard to cover all the possibilities by hand.