regex - regular expression: how to capture this group? -


a sample of text is:

per se: of itself.  ovo: beginning.  abattoir: slaught: erhouse.  

the capture group structure is:

enter image description here

group 1: beginning of line till first :

group 2: : (colon+1space) right after end of group 1

group 3: right after end of group 2 till end of line

my pattern is:

(^\w+)(: )(.+$) 

everything pattern ok except fact fails match first line of sample text(per se: of itself. )

any idea modification of pattern (or maybe new pattern) matches of lines?

how about

^([^:]+)(: )(.+$) 

i.e. match isn't colon (per spec).


Comments