How to get the date from txt file

Hi guys, could you please advise me, how i get date (highlighted yellow) from txt file - see image

image

Hi @martina.jancova

Could you be provide the input image as text then it will be easy for us to write regex.

One more question, 61F is static in the text or it will change in future.

Hi @martina.jancova ,
Have you tried regex ?

Hi, 61 is static. Thanks I will try regex

Hi, not yet. I´ll try it if you think it will be suitable for this. I have no experience with it yet

@martina.jancova

1 Like

Thank you for your support!

1 Like

Okay then you can use the below regular expressions.

System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“((?<=61F:)[A-Z a-z 0-9]{6})”)

The above regex will help when the data format is in DDMMYY or ddmmyy or 083023.

Hope you understand!! @martina.jancova

1 Like

@martina.jancova

use match not matches,the below regex will extract any alphabtes or digits upto length of 6

system.Text.RegularExpressions.Regex.Match(yourstring,“(?<=61F:)[A-Za-z0-9]{6}”).Value

cheers

1 Like

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