Maddy,
This scenario can very likely be addressed with one or more compound XPath expressions. However, I'm not well-versed enough in complex XPath and regular expressions to offer such an approach, so I will offer a coding approach instead.
My approach will make two assumptions:
1. The "subset" value to be extracted is a value of the following format: NNN-NNNNNNNN-X, where N is an integer and X is an alphabetic character
2. The "subset" value is on the fifth line/row.
First you need to use an XPath filter to extract the value using an XPath expression. If you have a smart enough expression to extract the subset value then you can enter that XPath here as well. Save the result of the XPath into a property
Now that you have extracted the multi-line value and saved it into a property using the XPath filter you can add a new Execute script step with the following code to save just the subset value:
// replace MyPropertyName with the actual name of the property where you saved the multi line value
String multiLineValue = testExec.getStateValue("MyPropertyName");
String[] values = multiLineValue.split("\n");
// if you know the value is always in the 5th line/row/index then you can get the value directly using index 4
String value = values[4].trim().substring(0, 12);
testExec.setStateValue("MyNewPropertyName", value);
// if you don't know if the value will be in the 5th line/row/index then you have to add some type of condition
// for example let's assume the value has to be 14 characters long with a hyphen as the 4th character...then
for (int i = 0; i < values.length; i++) {
String s = values[i];
// if "-" is in the 3rd index (e.g. 4th character in the string)
if (s.indexOf("-") == 3 && s.length() == 14) {
String newValue = s.substring(0, 12);
testExec.setStateValue("MyNewPropertyName", newValue);
return;
}
}