(.*) matches everything: why would it stop after "Deb"?

(\\w+) would IMHO better represent what you're trying to do

Regards,

Hervé

Le dimanche 26 février 2012 22:00:05 Chris Graham a écrit :
> Sorry, all, but this is driving me nuts! (And it's been a long hot day...)
> 
> I need some help with a RE Pattern that will match the following lines
> (as real samples):
> 
> (just ignore the //, they have come from the java comments):
> 
> //  (1589)  ---$ Deb "[maven-release-plugin] prepare for next
> development iteration"
> //  (1585)  ---$ Deb "[maven-release-plugin] prepare release GPDB-1.0.21"
> //  (1584)  ---$ Deb "This is my first changeset (2)"
> //  (1583)  ---$ Deb "This is my first changeset (1)"
> //  (1323)  ---$ Deb <No comment>
> //  (1319)  ---$ Deb <No comment>
> 
>     private static final String CHANGESET_PATTERN = "\\((\\d+)\\)
> (....) (.*) (.*)";
> 
> 
>         if ( changeSetRegExp.match( line ) )
>         {
>             ChangeSet currentChangeSet = entries.get( currentChangeSetIndex
> );
> 
>             String changesetAlias = changeSetRegExp.getParen( 1 );
>             String changes = changeSetRegExp.getParen( 2 );
>             String author = changeSetRegExp.getParen( 3 );
>             String comment = changeSetRegExp.getParen( 4 );
> 
>             System.out.println("-------------------------------------");
>             System.out.println(line);
>             System.out.println("changesetAlias = '" + changesetAlias + "'");
> System.out.println("changes        = '" + changes + "'");
> System.out.println("author         = '" + author + "'");
> System.out.println("comment        = '" + comment + "'"); }
> 
> But I'm getting some really wierd output:
> 
> 
> -------------------------------------
>   (1589)  ---$ Deb "[maven-release-plugin] prepare for next
> development iteration"
> changesetAlias = '1589'
> changes        = '---$'
> author         = 'Deb "[maven-release-plugin] prepare for next
> development iteration'
> comment        = ''
> -------------------------------------
>   (1585)  ---$ Deb "[maven-release-plugin] prepare release GPDB-1.0.21"
> changesetAlias = '1585'
> changes        = '---$'
> author         = 'Deb "[maven-release-plugin] prepare release GPDB-1.0.21'
> comment        = ''
> -------------------------------------
>   (1584)  ---$ Deb "This is my first changeset (2)"
> changesetAlias = '1584'
> changes        = '---$'
> author         = 'Deb "This is my first changeset (2)'
> comment        = ''
> -------------------------------------
>   (1583)  ---$ Deb "This is my first changeset (1)"
> changesetAlias = '1583'
> changes        = '---$'
> author         = 'Deb "This is my first changeset (1)'
> comment        = ''
> -------------------------------------
>   (1323)  ---$ Deb <No comment>
> changesetAlias = '1323'
> changes        = '---$'
> author         = 'Deb <No comment'
> comment        = ''
> -------------------------------------
>   (1319)  ---$ Deb <No comment>
> changesetAlias = '1319'
> changes        = '---$'
> author         = 'Deb <No comment'
> comment        = ''
> 
> 
> I can not understand why I am not getting the author delimited at the
> first space.
> 
> It should be "Deb" and not "Deb ....."
> 
> Can anyone offer my tired brain any assistance?
> 
> Ta.
> 
> -Chris
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to