groovy - What is causing the unexpected internal error when splitting a file path? -


i trying split file path in jmeter(3.2) using groovy , getting below error.

java.util.regex.patternsyntaxexception: unexpected internal error near index 1 \ ^ 

i able solve problem using solution mentioned in groovy split using file.seperator want know why getting error.

this code looked like

    \\executepath variable has c:\temp\somepath\anotherfolder\     def aa = vars.get("executepath").split("\\\\"); 

as far can tell, error should appear when split on "\\", because gets read escape character regex , nothing gets escaped. sure you're not using

split("\\") 

when try following, correct output

def bb = 'c:\\temp\\somepath\\anotherfolder\\' def aa = bb.split('\\\\') println aa output [c:, temp, somepath, anotherfolder] 

what trying accomplish splitting file path couldn't done java's path interface?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -

What is happening when Matlab is starting a "parallel pool"? -