Extract certain info with Regex

Hi everyone,

I currently have a process that was executed with uipath, which uses Regex, everything works fine, but recently it no longer recognizes the text I want.

Then I put the full text:

“FECHA DE GENERACIÓN: 7/01/2020 HORA: 4:00 P.M.”

where I just want to extract 7/01/2020

This is the regex line I use:
System.Text.RegularExpressions.Regex.Match (text, “[0-9] {2}. [0-9] {2}. [0-9] {4}”).tostring


you can use the Split method:


There seem to be a couple of issues.

  1. There are spaces in your regular expression.
  2. The {2} after the first pattern tells it to always require two digits whereas in your example it is just one: “7” instead of “07”.
  3. [0-9] can be replaced with the digit capture \d which makes the whole pattern shorter and (in my opinion) a little more readable.

Something like “\d{1,2}.\d{1,2}.\d{4}” is what I typically use.

Just prefer continue using Regex, the text around the date maybe change .

is that date format is fixed?

What do you think could have happened, since it initially worked smoothly


1 Like

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