I have the following problem matching, the data like below:
LABEL: TEXT1 TEXT2
The "LABEL" and "TEXT2" is optional, and separate by "\s"(blank or indent).
I would like to have 3 capture groups giving as output :
group1:LABEL(or None)
group2:TEXT1
group3:TEXT2(or None)
So I've written a regex like this :
\s*(\S*(?::))?\s*(\S*)\s*(.*$)
And the result is:
group1:LABEL:
group2:TEXT1
group3:TEXT2(or Null)
The problem is why group1 contain ":"?
And when TEXT2 doesn't exist, group3 is null instead of None