I'm trying to split this string into kind of a structure,
20:33:15 From Deekshitha Oku : Me too
into
{ time: "20:33:15", name: "Deekshitha Oku", message: "Me too" }
So for that, I wrote a Regex,
(([0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])(.*?)(From)\s(.*?).:\s(.*?).+
But it's not what I expecting, it wired here. What I expect is something like this,
[
"20:33:15",
"Deekshitha Oku",
"Me too"
]
const match = "20:33:15 From Deekshitha Oku : Me too".match(/(([0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9])(.*?)(From)\s(.*?).:\s(.*?).+/);
console.log(match);
What is the issue with this regex, I was tried many different ways :(
(?:except for when you actually want the content inside that capture group to be returned to you.