Reputation: 2063
a sample of my text is:
per se: of itself.
ovo: from the beginning.
abattoir: a slaught: erhouse.
the capture group structure is:
group 1: from the beginning of the line till first :
group 2: :
(colon+1space) right after end of group 1
group 3: right after end of group 2 till end of the line
my pattern is:
(^\w+)(: )(.+$)
everything with this pattern is ok except this fact that it fails to match first line of the sample text(per se: of itself.
)
any idea for modification of the pattern (or maybe a new pattern) so that it matches all of the lines?
Upvotes: 2
Views: 73
Reputation: 625
How about
^([^:]+)(: )(.+$)
i.e. match everything that isn't a colon (per your spec).
Upvotes: 4