From: Kimie Nakahara Date: 2009-03-16T11:10:54+09:00 Subject: Regex returning less number of groups - where is the error? Hello! I'm trying to build a regex to count the number of modified files by commit. For example, for the following svn log output: ------------------------------------------------------------------------ r727998 | bentmann | 2008-12-19 21:50:48 +1100 (Fri, 19 Dec 2008) | 4 lines Changed paths: 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 [MNG-3451] [MNG-3790] German localization for maven-core Submitted by: Christian Schulte o Applied with minor modifications ------------------------------------------------------------------------ r727871 | brett | 2008-12-19 11:48:07 +1100 (Fri, 19 Dec 2008) | 2 lines Changed paths: 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 [MNG-1830] use ISO 8601 format (not combined for readability) ------------------------------------------------------------------------ It need to return the revision number and the number of modified files, so the result of match would be something like : Result 1: 1. r727871 | brett | 2008-12-19 11:48:07 +1100 (Fri, 19 Dec 2008) | 2 lines 2. A /maven/components/branches/maven-2.0.x/maven-core/src/main/resources/org/apache/maven/messages/messages_de.properties 3. 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 3. M /maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java I tried many variations of the following regular expression: /(^r\d+.*?)(?:^Changed paths:\n)(^\s*[MDA]\s(?:\/[\w.-]+)+/m but either it returns incomplete results, as: 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 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 Would someone be able to help me on this? Thanks in advance!! Kimie -- Posted via http://www.ruby-forum.com/.