Is there someway of escaping characters in Groovy regexes? It would be nice to write a single backslash instead of 4.
+2
A:
You shouldn't need four of them. Two should be enough. e.g. to match anything with a backslash in it.
def file = /C:\geo\file.txt/
assert file =~ /.*\\.*/
jitter
2009-10-17 13:28:14
This code :`x = "\\geo\\file.txt";assert x =~ /\\/` says unexpected char :'\'.
Geo
2009-10-17 13:32:44
Ceck updated answer. This should work
jitter
2009-10-17 13:46:29