named groups splitting regardless of position of match
Posted
by
jeremy
on Stack Overflow
See other posts from Stack Overflow
or by jeremy
Published on 2012-03-24T22:58:40Z
Indexed on
2012/03/24
23:29 UTC
Read the original article
Hit count: 474
Having a hard time explaining what I mean, so here is what I want to do
I want any sentenced to be parsed along the pattern of
text #something a few words [someothertext]
for this, the matching sentence would be
Jeremy is trying #20 times to [understand this]
And I would name 4 groups, as text, time, who, subtitle
However, I could also write
#20 Jeremy is trying [understand this] times to
and still get the tokens #20 Jeremy is trying times to understand this
corresponding to the right groups
As long as the delimited tokens can separate the 2 text only tokens, I'm fine.
Is this even possible? I've tried a few regex's and failed miserably (am still experimenting but finding myself spending way too much time learning it)
© Stack Overflow or respective owner