You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Darren Hill <dh...@724.com> on 2002/09/27 18:05:48 UTC

[OT] Regular Expression for Validator

I suck.

I'm trying to come up with a reg expr for a Canadian Postal Code
(ie. M6P 3G6 .. or .. M6P3G6 )

I've got ...

<constant name="zip" value="^([A-Za-z]\d[A-Za-z]( |-)\d[A-Za-z]\d)$" />

IS THIS NOT RIGHT?

Darren.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [OT] Regular Expression for Validator

Posted by Eddie Bush <ek...@swbell.net>.
I hate dealing with regexps under JavaScript.  What I typically do is 
have to reference the JScript manual on MSDN every time I do something 
with them ...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsoriJscript.asp

Regexp syntax:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsgrpregexpsyntax.asp

Of course, you could also try:

www.irt.org - check out their JavaScript FAQ (scroll down a little)

Do you need to escape the space/- maybe?

( | -) to (\ |\-)     ???

It looks like you want to make it optional too:

( | -) to (\ |\-)?     ???

Darren Hill wrote:

>I suck.
>
>I'm trying to come up with a reg expr for a Canadian Postal Code
>(ie. M6P 3G6 .. or .. M6P3G6 )
>
>I've got ...
>
><constant name="zip" value="^([A-Za-z]\d[A-Za-z]( |-)\d[A-Za-z]\d)$" />
>
>IS THIS NOT RIGHT?
>
>Darren.
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>

-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [OT] Regular Expression for Validator

Posted by James Mitchell <jm...@telocity.com>.
Can you describe the allowable characters and I'd be happy to help.

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta




> -----Original Message-----
> From: Darren Hill [mailto:dhill@724.com]
> Sent: Friday, September 27, 2002 12:06 PM
> To: 'Struts Users Mailing List'
> Subject: [OT] Regular Expression for Validator
> 
> 
> I suck.
> 
> I'm trying to come up with a reg expr for a Canadian Postal Code
> (ie. M6P 3G6 .. or .. M6P3G6 )
> 
> I've got ...
> 
> <constant name="zip" value="^([A-Za-z]\d[A-Za-z]( |-)\d[A-Za-z]\d)$" />
> 
> IS THIS NOT RIGHT?
> 
> Darren.
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>