locked_user sundialsvc4 has asked for the wisdom of the Perl Monks concerning the following question:
Let’s say that I've got a very long string which I know to contain zero-or-more occurrences of the substring FOO something... BAR. And, let’s say that I know exactly how to construct a regular-expression that will correctly identify an occurrence of that substring, grab the piece I want out of it, etc. (“How to construct that regex,” then, is not the question.)
What has escaped my dim memory is ... what is the “elegant, perlish way” to produce, say, a list or an array of all of those occurrences, i.e. “all at once?”
If there were (say...) five occurrences of a matching pattern in the big, long string, the result would be a list or array with five entries.
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Grab "as many occurrences as there are" in a long string
by SuicideJunkie (Vicar) on Sep 23, 2010 at 20:48 UTC | |
|
Re: Grab "as many occurrences as there are" in a long string
by JavaFan (Canon) on Sep 23, 2010 at 21:31 UTC | |
by locked_user sundialsvc4 (Abbot) on Sep 24, 2010 at 13:30 UTC | |
by JavaFan (Canon) on Sep 24, 2010 at 13:39 UTC | |
|
Re: Grab "as many occurrences as there are" in a long string
by repellent (Priest) on Sep 24, 2010 at 17:53 UTC |