0

how can i reverse a query like this.

the url should match ".*window\.open.*"

I would have a scenario like...

the url should not match ".*window\.open.*"

How can i reverse the regexp?

Tried something like

".*[^window\.open].*"
"[^(window\.open)].*"
"[^window\.open].*"

Nothing works ;(

PatrickB
  • 3,225
  • 5
  • 31
  • 55
  • 1
    Couldnt you just test the match and negate the result? I mean, if the regexp matches, it obviously does not satisfy your second scenario. – Martin Vézina Oct 31 '13 at 15:11

1 Answers1

3

I am not aware of mink but you can use negative look-ahead if its regex engine supports it.

/^(?!.*window\.open).*/

regex101 demo

Note I would have preferred inverting match rather than inverting regex. Most of the language support inverting feature.

jkshah
  • 11,387
  • 6
  • 35
  • 45