You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sige <si...@yahoo.co.nz> on 2008/04/15 04:42:24 UTC

T5 regExp problem

Hi,

I have tried to use a  @Validate("regexp") to validate
a number field, the regexp used is:
numField-regexp=\\-*\\d*\\.*\\d*

However this doesnt work in T5 (5.0.9), the validation
is simply ignored, i have tested the regular
expression  in Java correct. I wonder if T5 supports
all java.util.regex.Pattern, or what I have gone
wrong?

Thanks

Sige

Send instant messages to your online friends http://au.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 regExp problem

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
That expression does exactly what you ask of it: checks if there is a 
combination of five digits *somewhere* in the input string. You'll have 
to anchor the expression to do what you really want.

So ^\d{5}$ should work.

-Filip

On 2008-04-16 02:39, Sige wrote:
> i might have found the reason:
> 
> it is not that @Validate("regexp") doesnt work, it
> actually checked the input and think the input is
> valid. However, it dosnt check the rest of the string.
> for example:
> 
> zip-regexp=\\d{5}
> 
> @Validate("regexp") checks only the first 5 chars in
> the input, and doesnt care about those following, and
> all the following inputs would be valid:
> 
> 12345
> 12345a
> 12345abcd
> ....
> 
> i have tested Tapestry 5.0.9 and 5.0.11 tutorial, and
> i think this may be a bug.
> 
> Cheers
> 
> Sige
> 
> 
> 
>  
> 
> 
> --- Sige <si...@yahoo.co.nz> wrote:
> 
>> Thank you, but still no luck.
>>
>> the only difference is that i use tomcat and i don't
>> pack the classes into a jar file. this doesn't seem
>> to
>> be the problem, since regular expressions provided
>> in
>> the tutorial work fine, such as:
>>
>> zip-regexp=\\d{5}(-\\d{4})?
>> credit-regexp=\\d{4}(\\-?\\d{4}){3}
>>
>> Cheers,
>>
>> Sige
>>
>>
>>
>> --- Lance Java <la...@googlemail.com> wrote:
>>
>>> Since your regex is defined in a property file,
>> you
>>> don't need to escape
>>> your backslashes as you do with a java string.
>>>
>>> try \-*\d*\.*\d*
>>>
>>> Cheers,
>>> Lance.
>>>
>>> On 15/04/2008, Filip S. Adamsen <fs...@fsadev.com>
>>> wrote:
>>>> That's odd, it works for me alright... Tapestry
>>> doesn't do anything
>>>> special wrt. regular expressions, it just uses
>> the
>>> java.util.regex stuff.
>>>> -Filip
>>>>
>>>> Sige skrev:
>>>>
>>>>> It seems @Validate("regexp") only support
>> fixed
>>> number
>>>>> of matches such as \\d{4}, and doesnt support
>>> "one or
>>>>> more" or "zero or more" matches(\\d* or \\d+).
>>>>>
>>>>> Sige
>>>>>
>>>>>
>>>>> --- Sige <si...@yahoo.co.nz> wrote:
>>>>>
>>>>>  Hi,
>>>>>> I have tried to use a  @Validate("regexp")
>> to
>>>>>> validate
>>>>>> a number field, the regexp used is:
>>>>>> numField-regexp=\\-*\\d*\\.*\\d*
>>>>>>
>>>>>> However this doesnt work in T5 (5.0.9), the
>>>>>> validation
>>>>>> is simply ignored, i have tested the regular
>>>>>> expression  in Java correct. I wonder if T5
>>> supports
>>>>>> all java.util.regex.Pattern, or what I have
>>> gone
>>>>>> wrong?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Sige
>>>>>>
>>>>>> Send instant messages to your online friends
>>>>>> http://au.messenger.yahoo.com
>>>>>>
>>>>>>
> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail:
>>>>>> users-unsubscribe@tapestry.apache.org
>>>>>> For additional commands, e-mail:
>>>>>> users-help@tapestry.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>> Send instant messages to your online friends
>>>>> http://au.messenger.yahoo.com
>>>>>
> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail:
>>> users-unsubscribe@tapestry.apache.org
>>>>> For additional commands, e-mail:
>>> users-help@tapestry.apache.org
>>>>>
> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail:
>>> users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail:
>>> users-help@tapestry.apache.org
>>>>
>>
>> Send instant messages to your online friends
>> http://au.messenger.yahoo.com 
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail:
>> users-help@tapestry.apache.org
>>
>>
> 
> 
> Send instant messages to your online friends http://au.messenger.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 regExp problem

Posted by Sige <si...@yahoo.co.nz>.
i might have found the reason:

it is not that @Validate("regexp") doesnt work, it
actually checked the input and think the input is
valid. However, it dosnt check the rest of the string.
for example:

zip-regexp=\\d{5}

@Validate("regexp") checks only the first 5 chars in
the input, and doesnt care about those following, and
all the following inputs would be valid:

12345
12345a
12345abcd
....

i have tested Tapestry 5.0.9 and 5.0.11 tutorial, and
i think this may be a bug.

Cheers

Sige



 


--- Sige <si...@yahoo.co.nz> wrote:

> Thank you, but still no luck.
> 
> the only difference is that i use tomcat and i don't
> pack the classes into a jar file. this doesn't seem
> to
> be the problem, since regular expressions provided
> in
> the tutorial work fine, such as:
> 
> zip-regexp=\\d{5}(-\\d{4})?
> credit-regexp=\\d{4}(\\-?\\d{4}){3}
> 
> Cheers,
> 
> Sige
> 
> 
> 
> --- Lance Java <la...@googlemail.com> wrote:
> 
> > Since your regex is defined in a property file,
> you
> > don't need to escape
> > your backslashes as you do with a java string.
> > 
> > try \-*\d*\.*\d*
> > 
> > Cheers,
> > Lance.
> > 
> > On 15/04/2008, Filip S. Adamsen <fs...@fsadev.com>
> > wrote:
> > >
> > > That's odd, it works for me alright... Tapestry
> > doesn't do anything
> > > special wrt. regular expressions, it just uses
> the
> > java.util.regex stuff.
> > >
> > > -Filip
> > >
> > > Sige skrev:
> > >
> > > > It seems @Validate("regexp") only support
> fixed
> > number
> > > > of matches such as \\d{4}, and doesnt support
> > "one or
> > > > more" or "zero or more" matches(\\d* or \\d+).
> > > >
> > > > Sige
> > > >
> > > >
> > > > --- Sige <si...@yahoo.co.nz> wrote:
> > > >
> > > >  Hi,
> > > > >
> > > > > I have tried to use a  @Validate("regexp")
> to
> > > > > validate
> > > > > a number field, the regexp used is:
> > > > > numField-regexp=\\-*\\d*\\.*\\d*
> > > > >
> > > > > However this doesnt work in T5 (5.0.9), the
> > > > > validation
> > > > > is simply ignored, i have tested the regular
> > > > > expression  in Java correct. I wonder if T5
> > supports
> > > > > all java.util.regex.Pattern, or what I have
> > gone
> > > > > wrong?
> > > > >
> > > > > Thanks
> > > > >
> > > > > Sige
> > > > >
> > > > > Send instant messages to your online friends
> > > > > http://au.messenger.yahoo.com
> > > > >
> > > > > 
> >
>
---------------------------------------------------------------------
> > > >
> > > > > To unsubscribe, e-mail:
> > > > > users-unsubscribe@tapestry.apache.org
> > > > > For additional commands, e-mail:
> > > > > users-help@tapestry.apache.org
> > > > >
> > > > >
> > > > >
> > > >
> > > > Send instant messages to your online friends
> > > > http://au.messenger.yahoo.com
> > > >
> >
>
---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail:
> > users-help@tapestry.apache.org
> > > >
> > > >
> > >
> >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail:
> > users-help@tapestry.apache.org
> > >
> > >
> > 
> 
> 
> Send instant messages to your online friends
> http://au.messenger.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
> 
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 regExp problem

Posted by Sige <si...@yahoo.co.nz>.
Thank you, but still no luck.

the only difference is that i use tomcat and i don't
pack the classes into a jar file. this doesn't seem to
be the problem, since regular expressions provided in
the tutorial work fine, such as:

zip-regexp=\\d{5}(-\\d{4})?
credit-regexp=\\d{4}(\\-?\\d{4}){3}

Cheers,

Sige



--- Lance Java <la...@googlemail.com> wrote:

> Since your regex is defined in a property file, you
> don't need to escape
> your backslashes as you do with a java string.
> 
> try \-*\d*\.*\d*
> 
> Cheers,
> Lance.
> 
> On 15/04/2008, Filip S. Adamsen <fs...@fsadev.com>
> wrote:
> >
> > That's odd, it works for me alright... Tapestry
> doesn't do anything
> > special wrt. regular expressions, it just uses the
> java.util.regex stuff.
> >
> > -Filip
> >
> > Sige skrev:
> >
> > > It seems @Validate("regexp") only support fixed
> number
> > > of matches such as \\d{4}, and doesnt support
> "one or
> > > more" or "zero or more" matches(\\d* or \\d+).
> > >
> > > Sige
> > >
> > >
> > > --- Sige <si...@yahoo.co.nz> wrote:
> > >
> > >  Hi,
> > > >
> > > > I have tried to use a  @Validate("regexp") to
> > > > validate
> > > > a number field, the regexp used is:
> > > > numField-regexp=\\-*\\d*\\.*\\d*
> > > >
> > > > However this doesnt work in T5 (5.0.9), the
> > > > validation
> > > > is simply ignored, i have tested the regular
> > > > expression  in Java correct. I wonder if T5
> supports
> > > > all java.util.regex.Pattern, or what I have
> gone
> > > > wrong?
> > > >
> > > > Thanks
> > > >
> > > > Sige
> > > >
> > > > Send instant messages to your online friends
> > > > http://au.messenger.yahoo.com
> > > >
> > > > 
>
---------------------------------------------------------------------
> > >
> > > > To unsubscribe, e-mail:
> > > > users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail:
> > > > users-help@tapestry.apache.org
> > > >
> > > >
> > > >
> > >
> > > Send instant messages to your online friends
> > > http://au.messenger.yahoo.com
> > >
>
---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail:
> users-help@tapestry.apache.org
> > >
> > >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail:
> users-help@tapestry.apache.org
> >
> >
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 regExp problem

Posted by Lance Java <la...@googlemail.com>.
Since your regex is defined in a property file, you don't need to escape
your backslashes as you do with a java string.

try \-*\d*\.*\d*

Cheers,
Lance.

On 15/04/2008, Filip S. Adamsen <fs...@fsadev.com> wrote:
>
> That's odd, it works for me alright... Tapestry doesn't do anything
> special wrt. regular expressions, it just uses the java.util.regex stuff.
>
> -Filip
>
> Sige skrev:
>
> > It seems @Validate("regexp") only support fixed number
> > of matches such as \\d{4}, and doesnt support "one or
> > more" or "zero or more" matches(\\d* or \\d+).
> >
> > Sige
> >
> >
> > --- Sige <si...@yahoo.co.nz> wrote:
> >
> >  Hi,
> > >
> > > I have tried to use a  @Validate("regexp") to
> > > validate
> > > a number field, the regexp used is:
> > > numField-regexp=\\-*\\d*\\.*\\d*
> > >
> > > However this doesnt work in T5 (5.0.9), the
> > > validation
> > > is simply ignored, i have tested the regular
> > > expression  in Java correct. I wonder if T5 supports
> > > all java.util.regex.Pattern, or what I have gone
> > > wrong?
> > >
> > > Thanks
> > >
> > > Sige
> > >
> > > Send instant messages to your online friends
> > > http://au.messenger.yahoo.com
> > >
> > >  ---------------------------------------------------------------------
> >
> > > To unsubscribe, e-mail:
> > > users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail:
> > > users-help@tapestry.apache.org
> > >
> > >
> > >
> >
> > Send instant messages to your online friends
> > http://au.messenger.yahoo.com
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5 regExp problem

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
That's odd, it works for me alright... Tapestry doesn't do anything 
special wrt. regular expressions, it just uses the java.util.regex stuff.

-Filip

Sige skrev:
> It seems @Validate("regexp") only support fixed number
> of matches such as \\d{4}, and doesnt support "one or
> more" or "zero or more" matches(\\d* or \\d+).
> 
> Sige
> 
> 
> --- Sige <si...@yahoo.co.nz> wrote:
> 
>> Hi,
>>
>> I have tried to use a  @Validate("regexp") to
>> validate
>> a number field, the regexp used is:
>> numField-regexp=\\-*\\d*\\.*\\d*
>>
>> However this doesnt work in T5 (5.0.9), the
>> validation
>> is simply ignored, i have tested the regular
>> expression  in Java correct. I wonder if T5 supports
>> all java.util.regex.Pattern, or what I have gone
>> wrong?
>>
>> Thanks
>>
>> Sige
>>
>> Send instant messages to your online friends
>> http://au.messenger.yahoo.com 
>>
>>
> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail:
>> users-help@tapestry.apache.org
>>
>>
> 
> 
> Send instant messages to your online friends http://au.messenger.yahoo.com 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 regExp problem

Posted by Sige <si...@yahoo.co.nz>.
It seems @Validate("regexp") only support fixed number
of matches such as \\d{4}, and doesnt support "one or
more" or "zero or more" matches(\\d* or \\d+).

Sige


--- Sige <si...@yahoo.co.nz> wrote:

> Hi,
> 
> I have tried to use a  @Validate("regexp") to
> validate
> a number field, the regexp used is:
> numField-regexp=\\-*\\d*\\.*\\d*
> 
> However this doesnt work in T5 (5.0.9), the
> validation
> is simply ignored, i have tested the regular
> expression  in Java correct. I wonder if T5 supports
> all java.util.regex.Pattern, or what I have gone
> wrong?
> 
> Thanks
> 
> Sige
> 
> Send instant messages to your online friends
> http://au.messenger.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
> 
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org