This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!
Submit FeedbackSolution attached.
Two sites that helped immensely with the RegEx I utilized (not sure why I bothered with spoiler tags three years later, but so be it):
https://www.boost.org/doc/libs/1_64_0/libs/regex/doc/html/boost_regex/syntax/basic_extended.html
This page helps a lot with dates:
https://help.alteryx.com/10.1/Reference/DateTimeFunctions.htm
Hello there @dataMack
Here my second take on this solution. I submitted my first one in 2017.
Without taking a peak at the other's solutions, I knew that it could be done to use one single REGEX tool to extract the 6 different date formats in this weekly challenge. Once all those date formats have been extracted, the approach is to create a null date field and start date parsing the matched formats; thus, you can see that if a date parse has been executed by matching it, the following attempts are not executed because the date field would not be null anymore.
The approach to extracting the 6 different date formats has to be from longest to shortest; we would first need to identify and define a DD-MM-YYYY before a D-MM-YY in the REGEX tool; the formula date parsing would work on a similar fashion; it would first parse the longest matches before parsing the shortest matches.
This was a really great challenge. Used the RegEx for the first time however i saw other solutions better than mine.
I am comfortable enough with regular expressions to turn to them to solve the thorniest of string manipulation problems. However, I always use the RegEx tool's expression builder with the dropdown to remind me of the syntax. Parts of this are kinda ugly because I got stuck trying to do too many things with one expression.