Hi Everyone,
I need help with my problem.
Let say I have a dynamic string,
Example:
Possible strings:
Scenario 1:
DEP ID: 23281439
Scenario 2:
DEP ID 1393773
My goal is to extract the dynamic numbers after the DEP ID or DEP ID:
How can I do that in regex?
As per checking in chatgbt I needed to use
DEP ID[: ]?(\d+)
But it is only working in DEP ID 1393773 but not in DEP ID: 23281439
hope someone can guide me accordingly.
Regards,
mkankatala
(Mahesh Kankatala)
2
Hi @alvin.c.apostol26
Try the below regular expressions,
(?<=(DEP ID\s*)|(DEP ID:\s*))[\d]+
Check the below image for better understanding,
![image](https://global.discourse-cdn.com/uipath/original/4X/3/2/5/325d8c234fbe70c9e3e4a4e6136275fa79b51019.png)
Hope it helps!!
Hello, can you try on a assign :
depID = System.Text.RegularExpressions.Regex.Match(yourString, “DEP ID:\s*(\d+)”).Groups(1).Value
Thanks it worked on my end ![:slight_smile: :slight_smile:](https://emoji.discourse-cdn.com/twitter/slight_smile.png?v=12)
1 Like
mkankatala
(Mahesh Kankatala)
5
It’s my pleasure… @alvin.c.apostol26
Happy Automation!!
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.