How to extract substring with dynamic length

Hi All,
Good morning!!!
I want to extract substrings from a list of strings with dynamic length.
For Example:
I have a list like [“Salary 1000”, “Payment others 500” “tax pay 200”]
Now I want to extract numbers from the above list and store them into excel sheet.
I have explored the tool but I could not find such action in it. I could find only one action i.e., “String Contains” which is checking just whether the substring is in given string or not.

Please help me. Thanks in Advance.

Why don’t you use regular expressions and loop over each string to find the substring with word boundary matching your number

e.g.,

<script language=“groovy”><![CDATA[
import java.util.regex.Pattern;
import java.util.regex.Matcher;
Pattern onlynumbers = Pattern.compile("\b\d+\b");
[
“this is 1”,
“2 is 2nd”,
“lets check 1 more… 3”
].each{
Matcher matcher=onlynumbers.matcher(it);
while(matcher.find()) {
System.out.println(matcher.group());
}
}
]]></script>

1 Like

Yes, using regex seems like the best way here.
If done only in recording with no scripting, the actions will look something similar to this:

Here is a sample recording substring.zip (1.2 KB) (made in version 1.3.0).