You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Andy2008 <ho...@yahoo.com> on 2010/04/16 02:18:33 UTC

PropertyRegex help

Here's my input

dev-abc.com:8001

I want abc.com:8001 back.  Below is my propertyregex

<propertyregex 	property="url"
		input="dev-abc.com:8001"
		regexp="dev-*"
	             select="\1"								             casesensitive="false" />

but <echo>${url}</echo> returns \1

Do you have any ideas?
-- 
View this message in context: http://old.nabble.com/PropertyRegex-help-tp28261946p28261946.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: PropertyRegex help

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
You might try wrapping the * in parens like

<propertyregex property="url" input="dev-abc.com:8001" regexp="dev-(*)"/>

Honestly, didn't try this - went back to look at some examples I've done 
in the past

On Thu, 15 Apr 2010, Andy2008 wrote:

>
> Here's my input
>
> dev-abc.com:8001
>
> I want abc.com:8001 back.  Below is my propertyregex
>
> <propertyregex 	property="url"
> 		input="dev-abc.com:8001"
> 		regexp="dev-*"
> 	             select="\1"								             casesensitive="false" />
>
> but <echo>${url}</echo> returns \1
>
> Do you have any ideas?
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: PropertyRegex help

Posted by Andy2008 <ho...@yahoo.com>.
It worked with the (.*).  You guys are awesome.

Thanks


David Weintraub wrote:
> 
> You need to learn about Regular Expressions and how they work.
> 
> Try regexp="dev-(.*)" instead of regexp="dev-*"
> 
> Note that I'm using "period asterisk" and not just an asterisk. An
> asterisk
> means zero or more of the previous "character" and period means any
> character". Combined, that means any string of any length (even zero in
> length).
> 
> The parentheses mark the area you want to select. Since it is the first
> pair
> of parentheses, it's "\1".
> 
> Here's a document I created to explain regular expressions: <
> http://dl.dropbox.com/u/433257/Regular_Expressions.doc>
> 
> On Thu, Apr 15, 2010 at 8:18 PM, Andy2008 <ho...@yahoo.com> wrote:
> 
>>
>> Here's my input
>>
>> dev-abc.com:8001
>>
>> I want abc.com:8001 back.  Below is my propertyregex
>>
>> <propertyregex  property="url"
>>                input="dev-abc.com:8001"
>>                regexp="dev-*"
>>                     select="\1"
>>                                 casesensitive="false" />
>>
>> but <echo>${url}</echo> returns \1
>>
>> Do you have any ideas?
>> --
>> View this message in context:
>> http://old.nabble.com/PropertyRegex-help-tp28261946p28261946.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
> 
> 
> -- 
> David Weintraub
> qazwart@gmail.com
> 
> 

-- 
View this message in context: http://old.nabble.com/PropertyRegex-help-tp28261946p28268989.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: PropertyRegex help

Posted by "Scot P. Floess" <sf...@nc.rr.com>.
Hee - good pt about the .* ;)

On Thu, 15 Apr 2010, David Weintraub wrote:

> You need to learn about Regular Expressions and how they work.
>
> Try regexp="dev-(.*)" instead of regexp="dev-*"
>
> Note that I'm using "period asterisk" and not just an asterisk. An asterisk
> means zero or more of the previous "character" and period means any
> character". Combined, that means any string of any length (even zero in
> length).
>
> The parentheses mark the area you want to select. Since it is the first pair
> of parentheses, it's "\1".
>
> Here's a document I created to explain regular expressions: <
> http://dl.dropbox.com/u/433257/Regular_Expressions.doc>
>
> On Thu, Apr 15, 2010 at 8:18 PM, Andy2008 <ho...@yahoo.com> wrote:
>
>>
>> Here's my input
>>
>> dev-abc.com:8001
>>
>> I want abc.com:8001 back.  Below is my propertyregex
>>
>> <propertyregex  property="url"
>>                input="dev-abc.com:8001"
>>                regexp="dev-*"
>>                     select="\1"
>>                                 casesensitive="false" />
>>
>> but <echo>${url}</echo> returns \1
>>
>> Do you have any ideas?
>> --
>> View this message in context:
>> http://old.nabble.com/PropertyRegex-help-tp28261946p28261946.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
>
>

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: PropertyRegex help

Posted by David Weintraub <qa...@gmail.com>.
You need to learn about Regular Expressions and how they work.

Try regexp="dev-(.*)" instead of regexp="dev-*"

Note that I'm using "period asterisk" and not just an asterisk. An asterisk
means zero or more of the previous "character" and period means any
character". Combined, that means any string of any length (even zero in
length).

The parentheses mark the area you want to select. Since it is the first pair
of parentheses, it's "\1".

Here's a document I created to explain regular expressions: <
http://dl.dropbox.com/u/433257/Regular_Expressions.doc>

On Thu, Apr 15, 2010 at 8:18 PM, Andy2008 <ho...@yahoo.com> wrote:

>
> Here's my input
>
> dev-abc.com:8001
>
> I want abc.com:8001 back.  Below is my propertyregex
>
> <propertyregex  property="url"
>                input="dev-abc.com:8001"
>                regexp="dev-*"
>                     select="\1"
>                                 casesensitive="false" />
>
> but <echo>${url}</echo> returns \1
>
> Do you have any ideas?
> --
> View this message in context:
> http://old.nabble.com/PropertyRegex-help-tp28261946p28261946.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>


-- 
David Weintraub
qazwart@gmail.com