Need to extract the value between the specified format

Description

Hi , I am retrieving the value from the bottom of the table as below.
1 - 9 of 9 Items.(Page No - 9 of 9 Items)
I want to extract the value between of and Items. The value keep changes based on data. some times its 9 ,20,100.
Kindly help to extract the value.
Thanks

Link

Date

2025-04-08

Related UiPath products

Studio

Hi @avinashy

Can you share sample input and expected output.

Regards

Hi @Parvathy ,
Input - 1 - 9 of 9 Items

Output - 9 ( the value between of and Items) .

There may be double digit, three digits also in future so need to handle the same.

Hope its clear.

Thanks

Hi @avinashy

Check the below regular expression:

Syntax:

Input = "1 - 9 of 9 Items"
Output = System.Text.RegularExpressions.Regex.Match(Input, "(?<=of\s*)\d+(?=\s*Items)").Value

Hope it helps!!

Hi @avinashy

Please use below expression.

output = System.Text.RegularExpressions.Regex.Match(input, “\d+(?=\s+of\s+\d+\s+Items)”).Value

Hi @Parvathy ,
Thanks it worked. I have similar query as below can you please help.
I am extracting a data table and the data is coming as below.
Input -
KHR P-25031 : RESOLVED summary items in List
KHR P-250350 : RESOLVED summary items in List
KHR P-2503800 : RESOLVED summary items in List
KHR P-25031500 : RESOLVED summary items in List
KHR P-250320000 : RESOLVED summary items in List
KHR P-25034000000 : RESOLVED summary items in List

I want to extract the value starting from P and till : , no space is required.
Mainly i want the value starting from P and the following integer value.
If you see after2503 the value is single,double,triple and keep on getting incremented.
Kindly suggest.
Thanks

Hi @avinashy

Use the below regular expression:

(?<=KHR\s*)P\-.*

Hope it helps!!

Hi @Parvathy Can you provide the full expression please.
Also i do not want the spaces at the end before : which is coming.
Thanks

Hi @avinashy

Use .Trim to remove the spaces. That won’t be an issue.

Regards

Its not working , getting some method overload error while executing.

Hi @avinashy

Try this syntax:

System.Text.RegularExpressions.Regex.Match(Input, "(?<=KHR\s*)P\-.*").Value.Trim()

Hope it helps!!