Do you really need a "negative" regex? Why not create a regex that tests that it contains "disabled" or "inactive", and test for it to be false?
'status: inactive' !~ /(disabled|inactive)/
Question
I want to test the web-element style: it shouldn't contain words "disabled" or "inactive".
La solution 2
Do you really need a "negative" regex? Why not create a regex that tests that it contains "disabled" or "inactive", and test for it to be false?
'status: inactive' !~ /(disabled|inactive)/
Autres conseils
Using negative lookahead:
>> 'status: inactive ' =~ /(?!.*(disabled|inactive))^/
=> nil
>> 'status: disabled' =~ /(?!.*(disabled|inactive))^/
=> nil
>> 'status: enabled' =~ /(?!.*(disabled|inactive))^/
=> 0