title: Groovy: Convert string with simple \
body: <p>I'm trying to convert a string I dynamically get, to double the \ or convert them as / (both are ok for me).</p>
  
  <p>It is formated as:</p>
  
  <pre><code>d:\code\main
  </code></pre>
  
  <p>I can't edit it at the source.</p>
  
  <p>In my tests, I tried using replace or replaceAll function, with \ to 5 \\\, but I always run into this error:</p>
  
  <pre><code>org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: 
  script15181726196231935876660.groovy: 4: unexpected char: '\' @ line 4, column 17. 
  String main = "d:\code\main\blabla\blabla"
  ^ 
  
  1 error 
  
      at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302) 
      at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:149) 
      at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:119) 
      at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:131) 
      at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:359) 
      at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:137) 
      at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:108) 
      at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:236) ...
  </code></pre>
  
  <p>Is there a way convert or rebuild this variable without falling in this Java error ?</p>
  
  <p>Thanks</p>