You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by John <jo...@quivinco.com> on 2013/05/23 14:51:18 UTC

validate regexp=^[A-Za-z0-9 ']+$ in template problem

how can my validate regexp contain an apostrophe please?

regards,
John

      102 <input t:type="TextField" t:id="firstname" t:value="firstName" 
      103 validate="required,regexp=^[A-Za-z0-9 ']+$" /> 


Unexpected character ''' at position 29 of input string: required,regexp=^[A-Za-z0-9 ']+$

Re: validate regexp=^[A-Za-z0-9 ']+$ in template problem

Posted by John <jo...@quivinco.com>.
Yeah, I tried that one, not so good.

Using the page properties is the way to go, keeps the markup nice and clean too.
  ----- Original Message ----- 
  From: Lance Java 
  To: Tapestry users 
  Sent: Thursday, May 23, 2013 2:32 PM
  Subject: Re: validate regexp=^[A-Za-z0-9 ']+$ in template problem


  Ah, so use &apos; in place of '

Re: validate regexp=^[A-Za-z0-9 ']+$ in template problem

Posted by Lance Java <la...@googlemail.com>.
Ah, so use &apos; in place of '

Re: validate regexp=^[A-Za-z0-9 ']+$ in template problem

Posted by John <jo...@quivinco.com>.
I believe it's the apostrophe cos its a valid deliminator in HTML, thanks for your suggestion (I bet it works!)
  ----- Original Message ----- 
  From: Lance Java 
  To: Tapestry users 
  Sent: Thursday, May 23, 2013 2:04 PM
  Subject: Re: validate regexp=^[A-Za-z0-9 ']+$ in template problem


  Your regex looks fine to me, perhaps tapestry is having troubles parsing
  the string to a list of validators. I wonder if the space character is the
  cause?

  Tapestry allows you to specify regexes in prop files. Try this:

  template:
  <input t:type="TextField" t:id="firstname" t:value="firstName"
  validate="required,regexp" />

  prop file:
  firstname-regexp=^[A-Za-z0-9 ']+$
  On 23 May 2013 13:50, "John" <jo...@quivinco.com> wrote:

  > how can my validate regexp contain an apostrophe please?
  >
  > regards,
  > John
  >
  >       102 <input t:type="TextField" t:id="firstname" t:value="firstName"
  >       103 validate="required,regexp=^[A-Za-z0-9 ']+$" />
  >
  >
  > Unexpected character ''' at position 29 of input string:
  > required,regexp=^[A-Za-z0-9 ']+$

Re: validate regexp=^[A-Za-z0-9 ']+$ in template problem

Posted by Lance Java <la...@googlemail.com>.
Your regex looks fine to me, perhaps tapestry is having troubles parsing
the string to a list of validators. I wonder if the space character is the
cause?

Tapestry allows you to specify regexes in prop files. Try this:

template:
<input t:type="TextField" t:id="firstname" t:value="firstName"
validate="required,regexp" />

prop file:
firstname-regexp=^[A-Za-z0-9 ']+$
On 23 May 2013 13:50, "John" <jo...@quivinco.com> wrote:

> how can my validate regexp contain an apostrophe please?
>
> regards,
> John
>
>       102 <input t:type="TextField" t:id="firstname" t:value="firstName"
>       103 validate="required,regexp=^[A-Za-z0-9 ']+$" />
>
>
> Unexpected character ''' at position 29 of input string:
> required,regexp=^[A-Za-z0-9 ']+$