Node Red novice
I have a string in a msg.topic with a date and time within it. An example is below:
Motion Detected from GardenEnd at 2022/9/24 17:43:05
This could also start with "Person Detected...." instead of "Motion Detected...".
My challenge is to format this into a string to be used as a filename but for sorting purposes, the date and time will need leading zeros in the month and day, where required.
Ideally, above would become:
GardenEnd_20220924_174305. mpeg
I think, even with my very basic novice understanding of the edit node, I can remove spaces and text I don't need. However, getting the date into the correct format is flummoxing me. Adding leading zeroes, where required, is the bit I cannot fathom.
I would have thought a regex could identify the string in the edit node but cannot work out what goes in the Replace With.
Also, edit nodes don't seem to have an option to add underscores or full stops.
I guess the whole string could be manipulated in one go with some json but, again, i am a bit of a novice, so have been using the edit node with many