How to get the first date in a string?


Let’s say we have a string that contains one or more dates with the same format “dd/MM/yy”

Example: " 02/12/19 this is the example 04/11/15 of the text that contains some dates 09/09/09"

I would like to get 02/12/19.

Thanks !

Please use Regex expression to get the first matching date format.

Regex expression -



hi @EngAnalyst

  1. to get only 1st date you can use,
    str1 = StringVar.Split(" "c)(1) —> it’ll split string with blank space (" ") and there’s 1 blank space at the starting of the string, the date index becomes (1).
    where StringVar —> is your string variable.
    str1 —> is your new String var will hold that 1st date.

  2. If you want to extract all the dates then you should use Matches activity and and set pattern as shown below