Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #4: Date Parsing

Elias_Nordlinder
11 - Bolide

Solved, fun little exercise.

 

Spoiler
Elias_Nordlinder_0-1626097477052.png
j_christian
7 - Meteor
Spoiler
Regular expressions and DateTimeParse make this less difficult than it looks.  However, if this was a real request for parsing out datetime from lots of strings, I'd advise using a library instead of writing the regular expressions, since these expressions will also pull nonsense strings of text and digits that match the date format..
ExploreMore
8 - Asteroid
Spoiler
First one I've solved in a while. I managed to solve using just one RegEx and Formula tool!


BobHaan
5 - Atom
Spoiler
BobHaan_0-1627575447345.png

 

 

I used two different RegEx expressions to pull out the dates:


(\d{1,2}[- ][a-zA-Z]{3,10}[- ]\d{2,4})       parses 16-APR-2005, 4-SEP-00

    ⦁ 1 to 2 digits                                                 \d{1,2}
    ⦁ either a dash ("-") or a space (" ")    [- ]
    ⦁ 3 to 10 letters                                           [a-zA-Z]{3,10} ---OR--- \D{3,10} ---OR--- [[:alpha:]]{3,10}
    ⦁ either a dash ("-") or a space (" ")    [- ]
    ⦁ 2 to 4 digits                                                 \d{2,4}

([a-zA-Z]{3}\s\d{1,2}[,]{0,1}\s\d{2,4})     parses Nov 16, 1900, Jan 5 2000

 

    ⦁ 3 letters                                                        [a-zA-Z]{3,10} ---OR--- \D{3,10} ---OR--- [[:alpha:]]{3,10}
    ⦁ a space (" ")                                                  \s
    ⦁ 1 to 2 digits                                                 \d{1,2}
    ⦁ an optional comma                                [,]{0,1}
    ⦁ a space (")                                                    \s

    ⦁ 2 to 4 digits                                                 \d{2,4}

 

I then use a formula to convert the RegEx Results into a useable date field:

 

BobHaan_1-1627575447416.png

 

This is one of the shorter solutions.  Note that the two RegEx functions could be combined into a single tool.

IraWatt
17 - Castor
17 - Castor

Maybe not the most efficient way but managed to parse them all. 

Spoiler
IraWatt_0-1627646579991.png

 

 

carmenrapariz
8 - Asteroid
Spoiler
Challenge 4.PNG
caitlynmcintyre
9 - Comet

I truly think this could be done in one tool but RegEx hurts my brain

Spoiler
caitlynmcintyre_0-1627969146149.png

 

MikeDroog
6 - Meteoroid

not the most elegant without a date parse tool but it works

Freddy123
7 - Meteor
Spoiler
FrederikF_0-1628069855015.png

 

JXEC
7 - Meteor

RegEx is my bane.

 

Here's my solution.