I have a field I need to query to get a value. the text in the field, is a string a couple of hundred characters long, and I need 4 characters, which are smack in the middle.
I have tried get substring, but I can only get it to show the data I'm looking for, and the 100+ characters after what I need.
Is there a way to get the substring, and then only return the first X number of characters of the string?
Or even better, get substring, between two "strings".
I gave Regex a go, and had no luck with that either.
The only thing I can provide as a "thing to trigger on" is
the br549 in the line below is the data I am looking to populate into the scripted field, and the data immediately before and after, is always the same
D;+ID=br549;+Client=
This gets me data, starting at br549, and then the rest of the field after that.
def path = doc['FIeld.keyword'].value;
int lastIDIndex = path.lastIndexOf('ID=');
if (lastIDIndex > 0) {
return path.substring(lastIDIndex+4);
}
return "";
Thanks in advance