While I’m extracting the data from web
It’s getting both text and date format so how can i get only date in it
Input :This one validates 23/09/2023 24/09/2023
I need only first date how can i do that
While I’m extracting the data from web
It’s getting both text and date format so how can i get only date in it
Input :This one validates 23/09/2023 24/09/2023
I need only first date how can i do that
Hi,
Can you try the following expression?
System.Text.RegularExpressions.Regex.Match(yourString,"\b\d{2}/\d{2}/\d{4}\b").Value
Regards,
Hi @Swathi_Raju
Try this regex:
strinput= "This one validates 23/09/2023 24/09/2023"
output= System.Text.RegularExpressions.Regex.Match(strinput,"\d+\/\d+\/\d+(?=\s)").Value
Hope it helps!!
Hi @Swathi_Raju
If your input is “This one validates 23/09/2023”. You can use the data manipulation for this.
- Assign -> Input = "This one validates 23/09/2023"
- Assign -> Output = Input.Split(" ").Last
The Output is String Variable which gives you the date from the Input data.
Hope it helps!!
Hi,
Use assign activity and in the value field you can use the following expression to extract the first date from your input string
System.Text.RegularExpressions.Regex.Match(yourInputString, “\d{2}/\d{2}/\d{4}”).Value
Hi @Swathi_Raju
If you find solution for your query please mark it as solution to close the loop.
Happy Automation
Regards,
Your solution it’s not working sometimes its getting the different formats of dates
Input=
“This one validates 23/09/2023 24/09/2023”
“This one validates 23-09-2023 24-09-2023”
“This one validates 23.09.2023 24.09.2023”
Like this I have seen the variations
Can you help on this @Parvathy
HI,
Can you try the following expression?
System.Text.RegularExpressions.Regex.Match(yourString,"\b\d{2}\W\d{2}\W\d{4}\b").Value
Regards,
HI @Swathi_Raju
System.Text.RegularExpressions.Regex.Match(“This one validates 23-09-2023 24-09-2023”,“[0-9\/-.]+(?=\s)”).Value.Trim
your input date format has anything it will match all the first date
System.Text.RegularExpressions.Regex.Match("This one validates 23-09-2023 24-09-2023","[0-9\\\/\-.]+(?=\s)").Value.Trim
Thank it’s worked both
@Yoichi @Praveen_Mudhiraj
Hey @Swathi_Raju
I know you got your answer already, but I wouldn’t be myself if I didn’t advertise a new activity
Starting from System 23.10.0-preview, you can use the Extract Date and Time from Text activity, which does the above quite quickly:
Here is the project in Studio Desktop:
ExtractDateAndTimeFromTextExample.zip (2.5 KB)
And one for Studio Web
Extract Date and Time from Text Example.uip (2.5 KB)
Obviously, a note here is that those will be extracted directly as a DateTime variable, instead of raw text.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.