Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAThank you, @Watermark and @AYXAcademy, for the challenge. It was a tough one, that's for sur :) Helped me to dive deeper into RegEx.
My approach follows a similar path & logic as @TurboToad - thinking this is a straightforward approach with just as few tools as possible from what I can gather :)
My results for tasks 2 & 5 match perfectly while tasks 1,3 & 4 are off just a tiny bit. Let me know what might need to be fixed there if you can.
Good challenge! That took a while and a lot of regex attempts.
Some slight variation in the outcome of task 4!
@AYXAcademy will post a solution next week, but I will say the solution that I submitted when I did it last year involved a complete isolation of all the elements of a web URL that you see in the "HINT" on URL structure, for every entry (see the answer for #2). The beauty of course is that everyone has an approach, and there is no 1 'right' way.
Yikes. Needed some chatGPT help on the regex, tbh
My solution. I tried to parse the url structure by RegEx, but as a result, some task are not matched.
You're 'so' close on your answer to #4.
Here's a couple hints, read the question 'very' carefully.
You didn't provide your flow so I can't be 100%, but think I see it from your notations. If all else fails, compare your results and provided results to identify discrepancies. You'll see it. Good luck.
@olga_strubbe , being as I've stared at this way too long I was happy to take a look. There was just a few records your expression was missing. I made some slight tweaks and this should resolve the mismatches.
These were the websites your expression wasn't quiet parsing correctly:
HTTP://WWW.WWD-INC.COM
HTTP://WWW.WWS-CPA.COM
WWW--EMBROIDME-COCKEYSVILLE--COM.RTRK.COM
WWW--EMBROIDME-FULLERTONMD--COM.RTRK.COM
HTTP://WWW-REDIRECT.EXT.HP.COM
2 of them have extra W's in front the url and the others have the hyphens between the WWW. I tweaked your expression and this should resolve it.
(HTTPS?\:\/\/)?(ww[w\d]*(?:\.w{2})?\.?)?([a-z0-9\-\.]*)([\/\?:].*)?$
There are also 2 records in task #2 that I believe are not correct in the solution:
@olga_strubbe, I took a look at your solution and think I can see why you're getting the variances.
There's a few oddball formatted websites that your expression isn't extracting the Base URL correctly.
I made a few tweaks to your expression and this get's it to match up.