How to retrieve value between 2 characters?
Extract
var Textstr="Cart Betweensaved Delimitersas inQuote ScenarioNo Editor:14393430*";
Usevar delimiter-basedmySubString extraction= whenstr.substring(str.lastIndexOf(":") + 1,str.lastIndexOf("*"));
You can use the below code to retrieve the value needed by a test appears between two stable characters or strings.
Recommended guidance
Confirm the start":" andend"*"delimiters
arestable across environments.Handle missing or repeated delimiters predictably.Trim only whitespace that is not part of the expected value.Avoid delimiter extraction when a structured field or locator is available.
Validation workflow
Capture the source text.Identify the start and end delimiters.Extract and normalize the value.Validate the extracted value or store it for later steps.
Last updated: SeptemberJune 20,26, 20262023
If you have any feedback on this topic, please contact us at documentation@appvance.ai