This worked for me...
on the controller side define your regex...
$scope.regex = "/^[^\'\"]+$/";


Then on your html you can call...
ng-pattern="{{regex}}"


if you named your controller on html side then you might have to change it 
to...
ng-pattern="{{name.regex}}"


You were also missing a forward slash at the start of your pattern but 
escaping single and double quotes does not work well on html side.

On Tuesday, August 13, 2013 at 11:37:02 AM UTC-4, Mark Volkmann wrote:
>
> I want to setup validation on a text input so single and double quote 
> characters are not allowed. This works to change single quotes:
>
> ng-pattern="^[^']+$/"
>
> I can't figure out the property syntax to modify this to also check for 
> double quotes. None of these work:
>
> ng-pattern="^[^'"]+$/"
> ng-pattern="^[^'\"]+$/"
> ng-pattern="^[^'\\"]+$/"
>
> -- 
> R. Mark Volkmann
> Object Computing, Inc. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" 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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to