Regex Help From Body of Text

Hi There,

Trying to learn about Regex but finding it difficult to pinpoint the string I want.

“Primary - *** ( ***** ) - Registration Date: 29/11/2011 2nd Username - ***** ( *** ) *** - *, **** - None 12/08/2019 - - 100K () trigger hit On **”

I was hoping to find an expression with Regex (or better solution) that would grab the date and assign to a string - the date will always follow “Registration Date”. I don’t want anything else stored in that variable.

Many Thanks!

1 Like

Hi
Hope this expression would help you resolve this
If the above value is in a string variable then
Use a assign activity and mention like this
str_output = System.Text.RegularExpressions.Regex.Match(str_input.ToString,”(Registration Date:\s)(\d)+\W(\d)+\W(\d)+”).ToString.Replace(“Registration Date:”,””).Trim

Cheers @Kyleb91

2 Likes

@Kyleb91,

For extracting a Date from a string, you can use below Regex Pattern:
(\d{1,4}([.-/])\d{1,2}([.-/])\d{1,4}) . Hope it helps, Kindly try and let me know your comments :slight_smile:

1 Like

Brilliant, appreciated as always @Palaniyappan, you genius :slight_smile:

1 Like

Brilliant, thanks for the reply, although this wouldn’t work as there could be more than one date in the string :slight_smile:

1 Like

Cheers @Kyleb91

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