Regex for first DateTime expression

Hi,

I need to get the first dateTime expression from this text:

XXXX…X xxxxx…x - X99XXXX
24.04.2018 09:44:02
26.04.2018 23:59:55

Any suggestions?
Thx. Kind Regards, Vanja

Hi @Activities_2020 ,

Variables: inputText (String): Your input text
pattern (String): “\d{2}.\d{2}.\d{4} \d{2}:\d{2}:\d{2}”
-matches (IEnumerable)
-firstDateTime (String)
Workflow:

  1. Assign: pattern = “\d{2}.\d{2}.\d{4} \d{2}:\d{2}:\d{2}”
  2. Matches Activity: Input: inputText Pattern: pattern Result: matches
  3. Assign: firstDateTime = matches(0).Value
1 Like

@VanjaV

try this

\d{2}\.\d{2}\.\d{4}

use this in match

cheers

1 Like

Hey @VanjaV try this approach in assign activity
firstDateTime = System.Text.RegularExpressions.Regex.Match(YourText, "\d{2}\.\d{2}\.\d{4}\s\d{2}:\d{2}:\d{2}").Value

Cheers

1 Like

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