How can i split the response of a variable


I am getting my cookies in a long format JESSIONID=2334456678SHG888;;secured. and i would like to split the string and save the first element as a global variable in my test. Does anyone know how i can do this.
I tried a few codes and nothing works. please see code in image



using regex you are able to get correct result

import java.util.regex.Matcher;
import java.util.regex.Pattern;

String test = "JSESSIONID=2334456678SHG888;;secured";
Pattern p = Pattern.compile("JSESSIONID=([^;]+)");
Matcher m = p.matcher(test);
while(m.find()) {
     def splitted ="=");