Re: Global matches, eq, @matches = ($str=~/('[^']+')/g)
"Daniel F. Savarese" <[email protected]> Fri, 25 Apr 2003 18:22:40 -0400
| Newsgroups | gmane.comp.jakarta.oro.user |
|---|---|
| Message-ID | <[email protected]> |
I didn't notice the example in the subject when I responded, so I may have misunderstood. If there is demand for m//g, then my inclination would be to add MatchResult getMatch(int index) and int getMatches(), with getMatch() returning getMatch(0) and all of the MatchResult interface methods operating on getMatch(0). The /c option would only have any meaning when a PatternMatcherInput was used as input. The crufty part is that all of those MatchResult interface methods will now be confusing. Another possibility is to have a nextMatch() and previousMatch() to iterate through the matches and a method to reset back to the first match. You'd still want to be able to index directly and also get the number of matches, but now when you choose a particular match, the MatchResult methods refer to the current match, instead of the first one. I don't know, file an enhancement request through Bugzilla and we can hash it out. It should probably go in after the v2.0.8 release. daniel