Need help with Regex expression

I am facing problem to extract date value which is in a paragraph text.

Sample para:
I am an IT professional working in Southern India.
I joined my new organization on April 20, 2024
My requirement happened through campus hire program.
I will be working on UiPath and Dot net related projects.

As per my use case, i will define start keyword and end key work which is IT and mode respectively and i want to extract the date which is in the second line.

My current regex patterns is : (?<=IT\s)(.*?)(?=requirement ) but it gets all the below text,

professional working in Southern India.
I joined my new organization on April 20, 2024
My

How to achieve the above problem statement in single regex ? Please help

Hi @Avinesh_Ramanathan

Try this regular Expression:

\w+\s*\d+\,\s*\d+

Regards

Thank you for your suggestion. But can you help me with start and end string along with date regex as that will be more useful for my realtime use case…

Hi @Avinesh_Ramanathan

Can you share the input and expected output what you want. I will help you.

This should also help you @Avinesh_Ramanathan

(?<=IT[\s\S]*?)\w+\s*\d+\,\s*\d+(?=[\s\S]*?requirement)

Regards

Hi @Avinesh_Ramanathan ,

Could you give this a try?
image

System.Text.RegularExpressions.Regex.Match(yourvar,"(?<=IT[\s\S]+)([A-Z][a-z]+[\d\s\,]+)(?=\s[\s\S]+requirement)").Value

Kind Regards,
Ashwin A.K

Are you looking for this?
grafik

1 Like

In the above para Line, i need to extract the date my DOJ i.e April 20,2024. As per the design my regex should have the defined start keyword and end keyword and along with that my date regex patter should also be there.

My current regex : (?<=IT\s)(.*?)(?=recruitment)
My current output :

professional working in Southern India.
My DOJ : April 20, 2024 at Bengaluru
My

My desired output is just : April 20, 2024

Hi @Avinesh_Ramanathan

The below regex should help you

(?<=IT[\s\S]*?)\w+\s*\d+\,\s*\d+[\s\S]*?(?=[\s\S]*?recruitment)

Regards

Thank you so much, helped me a lot…

1 Like

You’re welcome @Avinesh_Ramanathan

Happy Automation!!

in regex101 its not working… where can i check it?

Hi @Avinesh_Ramanathan

You can check it in https://regexr.com/ website or directly in UiPath.

If it works, please mark my post as solution to close the loop.

inputString = "My DOB : May 1, 1989 at Chennai
I am an IT professional working in Southern India.
My DOJ : April 20, 2024 at Bengaluru
My recruitment happened through campus hire program.
I will be working on UiPath and Dot net related projects."

outputString = System.Text.RegularExpressions.Regex.Match(inputString,"(?<=IT[\s\S]*?)\w+\s*\d+\,\s*\d+[\s\S]*?(?=[\s\S]*?recruitment)").Value.Trim()

Regards

ensure always in regex101:
grafik

do in UiPath your Rnd /Prototypings within the immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

and use it also for skill check
[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum

1 Like

Can you please me on how to extract date in dd/mm/yy format with lcoation as Bengaluru.

Can you help me with single regex statement → Start keyword as IT and End keyword as recruitment

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.