To get date from folder name

My folder name is " abggdv 5-24-19 ftydfty"

here i want to get only date in the folder name

please help me out to find solution

Hi, @brindhaS,
Store the folder name in the string variable like strName.
and use strName.split(" "c)(1).You will get only date.
If you find this useful mark it as solution.
Cheers…

2 Likes

Hi,
to extract a date format as above you can use Regex

β€œ\d{1,2}-\d{2}-\d{2}”

This will give you any date format with 2 digits follow by a - e.g. 01-05-19 or 11-05-19 or 5-25-19

1 Like

if the date is single digit like 2 (5-2-19) it not get selecting

@brindhaS

As @TimK mentioned i have just changed little bit in that regex. Try below regex once.

β€œ\d{1,2}-\d{1,2}-\d{2}”

2 Likes

As @Manjuts90 has amended, he has changed the second part to look for either 1 or 2 digits by changing {2} to {1,2} :slight_smile:

Thanks

Did you check mine @brindhaS

1 Like

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