Chaitanya MSV
Chaitanya MSV

Reputation: 6784

Combining two RegEx in JS

I have two JS RegExes /\?(?!xml)/ig which looks for any ? not followed by string "xml" and another /\?(?!>)/ig which looks for ? not followed by ">".

How do I combine both into a single regular expression?

Upvotes: 0

Views: 70

Answers (1)

elclanrs
elclanrs

Reputation: 94101

What about:

/\?(?!(xml|>))/gi

Edit: In any case consider parsing your XML properly with a parser instead of RegExp.

Upvotes: 3

Related Questions