Hi,
 I am using v 1.2. The bug was with earlier version. 
/i is not working for me. Any ideas where the mistake might be?

Regex I am using:
/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/
(from http://www.regular-expressions.info/email.html)

I tried 
"/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i"
 
(with /i modifier), 
and also 
"/^[A-Za-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/"


On Friday, July 19, 2013 at 12:37:07 PM UTC-7, estherM wrote:
>
> I'm very new to angular, so please forgive me if this is a very basic 
> question.
>
> I have a field that allows users to search for a location by entering 
> either a city and state or a zip code. I want to prevent a button from 
> becoming active if the format of their input is incorrect. I'm using 
> ng-pattern with regex on the input field, and it works if I use only a 
> single test (i.e. only the pattern for the city/state, or only the pattern 
> for the zip), but when I use the regex that would test for either, it seems 
> to ignore the regex and validate even if the pattern should return false. 
>
> Here's my pattern code:
>
> ng-pattern="/^([a-z]{2,},\s*[a-z]{2}|\d{5})$/i" 
>
> If I run this as straight javascript regex, as in this fiddle 
> <http://jsfiddle.net/VdSJs/1/>, it all works correctly, so I know the 
> regex itself is fine. Does the ng-pattern param not accept the 
> pipe-delimited patterns? And if not, how else could I go about this?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to