yonatan has asked for the wisdom of the Perl Monks concerning the following question:
i wish to match the "neither-nor" couples in the following text sample:
".. Neither Jack nor Peter wants to go to the party next week. Neither Jane nor her friends support the mayor. .."
suggested matching pattern is:
(\bneither\b)[^.?!;]*?(\bnor\b)i want to get the location of BOTH the first (\bneither\b) and its following (\bnor\b).
the location information may be similar to that returned by pos(), i.e. the following character position when //g is in use.
my questions:
1. is there an elegant way to return the position of single parenthesized group?
2. -"- the position of each group out of multiple groups?
thank you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex : finding the location multiple clustered (in parenthesis) groups
by BrowserUk (Patriarch) on Aug 02, 2010 at 10:15 UTC | |
by wol (Hermit) on Aug 02, 2010 at 11:46 UTC | |
by yonatan (Novice) on Aug 02, 2010 at 12:19 UTC | |
|
Re: regex : finding the location multiple clustered (in parenthesis) groups
by patrick.j (Acolyte) on Aug 02, 2010 at 12:02 UTC |