You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Chris Graham <ch...@gmail.com> on 2012/02/26 12:00:05 UTC
Help with RE!
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-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Help with RE!
Posted by Chris Graham <ch...@gmail.com>.
Not only would it better represent what I want, IT WORKS TOO! :-))))
Thanks!
Now, as to why? 'Cause it appears to have done the job in other areas:
// Workspace: (1000) "BogusRepositoryWorkspace" <-> (1000)
"BogusRepositoryWorkspace"
// Workspace: (1156) "GPDBWorkspace" <-> (1157) "GPDBStream"
private static final String WORKSPACE_PATTERN = "\\((\\d+)\\)
\"(.*)\" <-> \\((\\d+)\\) \"(.*)\"";
/**
* @see #WORKSPACE_PATTERN
*/
private RE workspaceRegExp;
// Component: (1001) "BogusComponent"
private static final String COMPONENT_PATTERN1 = "\\((\\d+)\\) \"(.*)\"";
/**
* @see #COMPONENT_PATTERN1
*/
private RE componentRegExp1;
// Component: (1158) "GPDB" <-> (1157) "GPDBStream"
private static final String COMPONENT_PATTERN2 = "\\((\\d+)\\)
\"(.*)\" (.*)";
/**
* @see #COMPONENT_PATTERN2
*/
private RE componentRegExp2;
// Baseline: (1128) 27 "BogusTestJazz-3.0.0.40"
private static final String BASELINE_PATTERN = "\\((\\d+)\\)
(\\d+) \"(.*)\"";
/**
* @see #BASELINE_PATTERN
*/
private RE baselineRegExp;
But, looking at it anew, it appears that because I'm asking it for
alternate string, numbers, place markers (<->) etc, it's better able
to work out what I want.
Let me see if I can review the RE's that I'm currently using and see
what comes up.
I do wish that people had left some comments in as to some example
output of other scm tools to make working out their patterns a lot lot
easier. Mutter. Grumble. Mutter... :-)
-Chris
On Mon, Feb 27, 2012 at 3:01 AM, Hervé BOUTEMY <he...@free.fr> wrote:
> (.*) 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-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Help with RE!
Posted by Hervé BOUTEMY <he...@free.fr>.
(.*) 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-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org