http://www.perlmonks.org?node_id=1097198


in reply to Matching a regular expression group multiple times

As far as I know, there are (just) two issues at-bar here:

  1. If you want to match zero-or-more adjacent occurrences of a single string, in any particular place within the source, then you must use a quantifier such as + ... and the search should be “greedy.”
  2. If you need to match multiple times within the same string, the modifiers /gc should be used, within a loop that will then search through and exhaust the input string.

And, that’s it.