Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

a RegEx to find all HTML tags *not* matching a list

1 view
Skip to first unread message

R.Wieser

unread,
Aug 9, 2023, 6:02:16 AM8/9/23
to
Hello all,

I'm stuck. I've got a simple regex like this :

oRegExp.Pattern = "(<(div|span))"
Text = oRegExp.Replace(Text,"~{$1}~")

, which works ("~{" and "}~" are just delimitors for debugging purposes).

But now I would like to to find all html tags which are *not* either "div"
or "span", and can't seem to find a solution. I thought that simply adding
a "^" negate would work :

oRegExp.Pattern = "(<^(div|span))"

Alas, now /nothing/ matches anymore (but I'm not getting any errors). :-(

I've just spend an hour or so tryinging to google a solution, but can't get
them to work either. :-|

tl;dr:
How do I create a pattern that will match all html tags /but for/ the ones
provided ?

Ah, almost forgot to mention: its about VBScript as running on XP pro.

Regards,
Rudy Wieser


R.Wieser

unread,
Aug 9, 2023, 7:45:15 AM8/9/23
to
> I'm stuck.

Scratch that.

Instead of using "^(" (or "(^") it turns out I need to use "(?!".

The odd thing is that I remember having used that "?!" - but most likely not
in the right combination with further filtering. :-\

Regards,
Rudy Wieser


0 new messages