I get that this is a check in date, but you should be able to to use Launch to manipulate the date data better.. basically do some pre-work in Launch to make your life easier in analytics...
Trying to parse date information via regex from a string value is very hard. Even trying to parse a numerical formatted date (still string) via regex is hard. Parsing information from an actual date object using scripting languages is easy.
ISO 8601 is an international standard date format. It is much easier to work with than the "human readable" format you have currently.
Human Readable: Fri Nov 18 2023
ISO 8601: 2023-11-18
(This standard also includes standards for adding timestamps, if you had to go to that granularity, such as 2023-11-18T13:54:36Z-0500 - which represents the time and timezone)
Technically, both the human readable and the ISO date can be parsed cast as a date object in JavaScript... but when it comes to Regex, it's a lot harder...
In JS you could easily do the following in Launch:
var checkInDate = new Date("Fri Nov 18 2023");
// results in "Fri Nov 17 2023 19:00:00 GMT-0500 (Eastern Standard Time)"
// Date
var date = checkInDate.getMonth()+1 + "/" + checkInDate.getDate() + "/" + checkInDate.getFullYear();
// "11/18/2023"
// Week Number
// Note this is based on Gregorian Calendar, you are using fiscal weeks and would have to adjust it
startDate = new Date(checkInDate.getFullYear(), 0, 1);
var days = Math.floor((checkInDate - startDate) /
(24 * 60 * 60 * 1000));
var weekNumber = Math.ceil(days / 7);
var weekNumberFinal = checkInDate.getFullYear() + ":FW" + weekNumber;
// results in "2023:FW46" (looks like you have to adjust by 3 weeks for your fiscal year, you wanted "49", this gets you "46")
// Etc
Whereas, if you are trying to do this all via classifications, you will have to have much more complex rules to read the text version of the month to parse out the right numbers, then you would have to have combination text month and day number logic (for each week) to get the "week number"
To be honest, if I were doing this, I would actually parse all the values the way you want in Launch, pass them as one big pipe delimited string like so:
"11/18/2023|2023|2023:FW49|2023:FM11|2023:FQ04|2023:SW49|2023:SM01|2023:SQ04"
Then use Classifications to just parse out parts by position....something like:
/(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)\|(.*)/g
Then just take group1, or group2, or group8, etc into your classification....
Group1 being the Date
Group2 being the Year
Group3 being FW Number
etc
Make your life easier by using Launch to do the "heavy lifting", which will be much easier using JS than Regex.
Hi
Thanks for the Help! I will try this from Lunch 🙂