byrdr
byrdr

Reputation: 5457

Regular expression chain multiple conditions

I have a regular expression which is replacing all of the opening except for <b></b> tags, which it ignores. How would I also add an expression to ignore <i></i> tags?

/<(?!\/?b(?=>|\s.*>))\w[^>]*>/gm

Upvotes: 1

Views: 168

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 626689

Use <(?!\/?[bi](?=>|\s.*>))\w[^>]*> regex.

[bi] means either 'b' or 'i'.

Upvotes: 1

Related Questions