I have a
case in my Ruby code that basically tries to match string in a couple of ways and do different things to it accordingly, kind of like that:
case inst when Rx_inst1 (some function) when Rx_inst2 (some other function) end
This works beautifully (I'm not posting the RegEx as it's very, very long and works well). However, when I tried implementing the following modification, so that even when the RegEx matches a string, the condition is not executed if it contains a substring:
case inst when Rx_inst1 (some function) when Rx_inst2 && !/dom\./ (some other function) end
Rx_inst2 stopped matching
inst when it was equal
Nm. Friese = Fryzyjczyk, ko? fryzyjski or any other kind of string it matched before.
I got the exact same result with
&& /dom\./ and
&& inst.include?('dom.') which, according to other answers, are proper syntax. What am I doing wrong?