Response is :Set-Cookie: ADCSESSID=e11dd94e-ee22-4313-84bc-df5040acf101; Domain=.auction.com; httponly; Path=/
I need only ADCSESSID value. So
Regular expression is : "ADCSESSID=(.+?);"
Check this using java regualr expression tester : http://ocpsoft.org/tutorials/regular-expressions/java-visual-regex-tester/#!;t=User%20clientId%3D23421.%20Some%20more%20text%20clientId%3D33432.%20This%20clientNum%3D100&r=(clientId%3D)(%5Cd%2B)&x=***masked***
Reference doc:
http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
String jsonString = prev.getResponseHeaders();
//System.out.println(jsonString);
SampleResult.setResponseData( jsonString );
text = prev.getResponseHeaders();
patternText = "ADCSESSID=(.+?);";
//System.out.println(patternText);
p = java.util.regex.Pattern.compile(patternText, java.util.regex.Pattern.DOTALL);
System.out.println("p value is "+p);
m = p.matcher(text);
System.out.println("matcher m value is " +m);
if (m.find()) {
vars.put("beanShellExecutionId", m.group(1));
} else {
vars.put("beanShellExecutionId", "NOT_FOUND");
}
System.out.println(vars.get("beanShellExecutionId"));
I need only ADCSESSID value. So
Regular expression is : "ADCSESSID=(.+?);"
Check this using java regualr expression tester : http://ocpsoft.org/tutorials/regular-expressions/java-visual-regex-tester/#!;t=User%20clientId%3D23421.%20Some%20more%20text%20clientId%3D33432.%20This%20clientNum%3D100&r=(clientId%3D)(%5Cd%2B)&x=***masked***
Reference doc:
http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html
String jsonString = prev.getResponseHeaders();
//System.out.println(jsonString);
SampleResult.setResponseData( jsonString );
text = prev.getResponseHeaders();
patternText = "ADCSESSID=(.+?);";
//System.out.println(patternText);
p = java.util.regex.Pattern.compile(patternText, java.util.regex.Pattern.DOTALL);
System.out.println("p value is "+p);
m = p.matcher(text);
System.out.println("matcher m value is " +m);
if (m.find()) {
vars.put("beanShellExecutionId", m.group(1));
} else {
vars.put("beanShellExecutionId", "NOT_FOUND");
}
System.out.println(vars.get("beanShellExecutionId"));