An attempt to create a java.util.regex.Pattern from a variable that is declared as a String fails with a java.lang.ClassCastException: java.util.regex.Pattern cannot be cast to java.lang.String
The code below worked with Groovy 1.7.8 but fails with Groovy 1.8.0
String s = "^\\S+$value\$"
def p = ~s <==Fails here
A workaround is to change the last statement to:
def p = ~/$s/
but that adds clutter