Removing date from string
pmazzoni
I have strings like:
2022-02-11_9051b
2022-02-11S9051b
S9051D2022-02-11
I want to extract the date, which is always in format YYY-MM-DD. I can use grepstr to check whether the string contains a date in this format. But how can I find the location in the string of the date, or somehow extract it? greplist won't cover the cases where the separator is not something standard like "_". And I can't use strSearch because I don't know of a wildcard character specifically for digits. Or maybe it's possible to search for a digit using one of the str functions?
This function will give you the date from any string if the date is in the format YYYY-MM-DD:
string out
SplitString/E=("([0-9]{4}-[0-9]{2}-[0-9]{2})") in, out
return out
End
Example:
2022-02-11
February 17, 2024 at 01:39 pm - Permalink
Thank you!
February 18, 2024 at 06:06 am - Permalink