Details
-
Bug
-
Resolution: Done
-
Major
-
5.1.1.FINAL
-
None
-
None
Description
According to official documentation, it is not necessary to use escapes:
"In contrast to Java, escapes are not needed within regular expressions written as string literals." (a note in topic 4.8.2.1.5.)
But it is not true. Actually even the example of the documentation does not work if you do not use escape:
//type is a String
Cheese( type matches "(Buffalo)?\S*Mozarella" )
... should be changed to:
//type is a String
Cheese( type matches "(Buffalo)?
S*Mozarella" )
Curiously, if you have a attribute of the attribute which matches a regex, you shouldn't use escapes:
//type is "complex type" and value is a String
Cheese( type.value matches "(Buffalo)?\S*Mozarella" )
... it's work!
That said, a workaround to work with simple String attributes, you should use "toString":
//type is "String"
Cheese( type.toString matches "(Buffalo)?\S*Mozarella")