Hello all,
I would need to get the date, but I am not able to find the correct Regex code. Could you help me please?
This is the sentence and I need to get “25/11/20”.
“FECHA 25/11/20”
This is what I tried: (?<=FECHA\s+)[\d,]+
But i just get “25”.
Many thanks
Angel
@Angel_Llull
To match a date in mm/dd/yyyy format, rearrange the regular expression to
^(0[1-9]|1[012])- /. - /. \d\d$.
For dd-mm-yyyy format, use ^(0[1-9]|[12][0-9]|3[01])- /. - /. \d\d$.
sarathi125
(Parthasarathi)
November 30, 2020, 8:12am
3
@Angel_Llull ,
Try with this regex,
\d?[\/|\-|\s]?\d?[\/|\-|\s]\d(\s?)[\/|\-|\s]?\d?(\s?)[\/|\-|\s]\d{2,4}[\s]?$
@Angel_Llull regexx.zip (14.3 KB) Take this xaml for your reference .
Happy learning:)
Akshay07
(Akshay Suryawanshi)
November 30, 2020, 8:14am
5
Angel_Llull:
FECHA 25/11/20
Hello @Angel_Llull
(?<=FECHA\s)([0-2][0-9]|(3)[0-1])(/)(((0)[0-9])|((1)[0-2]))(/)\d{2}$
1 Like
Hello @Akshay07 ,
i am trying this in website RegExr and it gets the date. But in Studio, the variable is empty.
Do you know why is it happening?
Thanks
Hello @sarathi125 ,
Thanks! But I am trying it and the variable is empty… Do you know why would it be happening?
Many thanks
Hello!
Sorry because I did not write whole text because I thought that maybe it was not necessary. But this is the whole sentence:
011A11 00000000 FECHA 25/11/20 CALLE
Would the code change in this case?
Sorry for the inconveniences.
Thanks!
Angel
ppr
(Peter)
November 30, 2020, 8:55am
9
@Angel_Llull
have a look here:
(?<=FECHA )(\d+\/?){3}
3 Likes
Hey
If you want to learn Regex - check out my Regex Megapost.
1 Like
system
(system)
Closed
December 3, 2020, 9:31am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.