Want to extract date and name alone from the string (Using Regular Ex)

Hello Everyone,

Below is the string which could be dynamic. Want to extract the date and name alone from this string.

Delivery - Additional Information Requested - 2022-09-20 14:06:04 - r.lalit.athawale

Thanks
Rushi

@Yoichi need help!

HI @Athawale_Rushikesh

How about this expression?

System.Text.RegularExpressions.Regex.Match(YourString,"\d.{4}\d.{2}\d{2}").Tostring

Output -> 2022-09-20

System.Text.RegularExpressions.Regex.Match(YourString,"\S*$").Tostring

Output -> r.lalit.athawale

Regards
Gokul

Another method to extract NAME

System.Text.RegularExpressions.Regex.Match(YourString,"(?<=-\s)\S*$").Tostring

Output -> r.lalit.athawale

Check output screenshot @Athawale_Rushikesh

image

Regards
Gokul

Hi,

How about the following?

Date

System.Text.RegularExpressions.Regex.Match(yourString,"\b\d{4}-\d{2}-\d{2}\b").Value

Name

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=-\s*)[^-]+$").Value

Sequence.xaml (7.0 KB)

Regards,

Thanks @Gokul001

The solution is crisp with the explanation.

1 Like

Thanks @Yoichi

1 Like

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