I'm struggling to complete my regex statement for extracting the content following a static word because I'm not entirely sure how to properly tell the regex to finish its extraction with either a comma or the end of the sentence.
Subject A string that will vary in order and amount of content. The only consistencies are the names that will appear, which in this case are Bob and Mike.
So for example, sometimes the string will appear:
"Bob: 44-51mL/kg/min, Mike: (Bodyweight)1.5 minutes"
Other times:
"Mike: (Bodyweight)1.5 minutes"
And so on:
"Mike: (Bodyweight)1.5 minutes, Bob: 44-51mL/kg/min"
What I have so Far:
\Mike:?(\s.*?)?(,)|$
Because the names within the string are static I have written a regex code to use them as a starting point in the extraction, the semicolon is lazy because sometimes that may not be in the string, but for the ending point of the extraction if a comma is present the extraction should consider that the end point, but if a comma is not present, the extraction should collect the content up until the end of the sentence.
For some reason what I have above only works when there is a comma and will not produce any output if there is no comma, where properly functioning, it would be elsing to the end of sentence.