Last active
June 5, 2019 13:35
-
-
Save AndersDJohnson/5905129 to your computer and use it in GitHub Desktop.
groovy inverse regex operator?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// as expected: | |
println ("string" ==~ "str.*") | |
// => true | |
// compiles, but not as expected: | |
println ("string" !=~ "str.*") | |
// => true | |
// does not compile: | |
//println ("string" !==~ "str.*") | |
// this is the solution: | |
println (! ("string" ==~ "^str.*")) | |
// => true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment