With Capybara I am used to searching first('div', text: 'asdf'), but is there a way to search for elements that do not have the text?
I tried first('div', text: /^(?!asdf)/) and it still matches on div with 'asdf' text.
I checked to make sure my regex is right though: https://rubular.com/r/CN6MYKJNahiohD
Any ideas?
Not sure about Capybara, just guessing that you might be trying to design an expression that would exclude
asdfwith word boundaries in a string, maybe close to:The expression is explained on the top right panel of regex101.com, if you wish to explore/simplify/modify it, and in this link, you can watch how it would match against some sample inputs, if you like.
Test