From: Heesob Park Date: 2009-03-16T13:43:55+09:00 Subject: Re: Regex returning less number of groups - where is the err 2009/3/16 Kimie Nakahara : > Hi Park, thank you for the quick answer. Using your regex, I get the > following result: > > Result 1 > > 1. r727998 | bentmann | 2008-12-19 21:50:48 +1100 (Fri, 19 Dec 2008) | 4 > lines > 2. A > /maven/components/branches/maven-2.0.x/maven-core/src/main/resources/org/apache/maven/messages/messages_de.properties > M > /maven/components/branches/maven-2.0.x/maven-core/src/main/resources/org/apache/maven/messages/messages_en.properties > > Result 2 > > 1. r727871 | brett | 2008-12-19 11:48:07 +1100 (Fri, 19 Dec 2008) | 2 > lines > 2. M /maven/components/branches/maven-2.0.x > M > /maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java > > I returns all modified lines, but in the same group. So, for example, > to know how many files were modified in revision 727998, I would have to > work on the result[0][1] and result[1][1] ( (or 1.2 and 2.2 as in > example above) to extract the number of modified files.  Maybe splitting > the text and counting how many files were modified (1 per line). > Actually I tried to do it splitting by \n, but it didn't work. So what I > was wondering if it possible to return each modified line as a diferent > group, as I said in the first email. > > Or, if you can suggest a way to break the lines of results[0][1] and > results[1][1], it would make it too! > Or try with the more simple regex: /(^r\d+.*?)(?:^Changed paths:\n)|(^\s*[MDA]\s\/[\w.\/-]+\n)/m Regards, Park Heesob