Search Posts

Category: regex

How do i use Regular expression in ng-pattern to avoid certain special character?

I have to avoid some some special characters in ng-pattern. I can able to avoid all special characters by using following code ng-pattern=”/^[a-zA-Z0-9]*$/” But I have to avoid only these charecters %;:'”,<> How to do write ng-pattern Update: <input type=”text” class=”txt_box” ng-disabled=”filechoosen” name=”file_name” ng-pattern=”/^[^%;:x27x22,<>{}[]/]*$/” ng-model=”filenameedit” id=”filenameedit”> <div style=”color:Red” ng-show=”file_name.$error.pattern “>These charecters are not allowed</div> Source: AngularJS

How do I append "ng-click()" to <img> tags on an array of dynamically added html?

how to How do I append "ng-click()" to <img> tags on an array of dynamically added html? I’m very new to AngularJS and I’m figuring out how to add an ng-click on all img tag so I can get a display what I click them. The logic I’m thinking is using angular.foreach to track all the contents of the array with regex and append their src’s along with an ng-click. Here’s code for scouring the […]

Grunt correspoding Nginx configuration for Angular application

how to Grunt correspoding Nginx configuration for Angular application I have a configuration for Grunt server below livereload: { options: { open: true, middleware: function (connect) { return [ modRewrite([‘^[^.]*$ /index.html [L]’]), connect.static(‘.tmp’), connect().use( ‘/bower_components’, connect.static(‘./bower_components’) ), connect().use( ‘/app/styles’, connect.static(‘./app/styles’) ), connect.static( ]; } } }, It works perfectly with Grunt development-environment, but now I would like to have the same modRewrite configuration for Nginx also, as I put the app into production. What is […]

AngularJs $httpbackend.whenPOST regular expression not working

how to AngularJs $httpbackend.whenPOST regular expression not working am getting an error Error: Unexpected request: POST data/employee/1 No more request expected Am using angular-mocks, angular-ui-route in my app.config i’ve got my $stateProvider routes and my mocks the main one with the issue being the one below: $httpBackend.whenPOST(/data/employee/(d+)/, {}, {},[‘id’]).respond(function(method, url, data, headers, params){ console.log(‘Received these data:’, method, url, data, headers, params); return [200, {}, {}] }); Calling via controller: app.controller(“employeeController”, [‘$scope’,’$http’, “$state”, “$stateParams”, function($scope, $http, […]

Regex for Search as you Type

how to Regex for Search as you Type I am trying a regex to use for my search as you type textarea, and I am stuck here: What I want is to show suggestions only when the user types two curly braces, and I don’t know how to achieve it i.e. how to treat the curly braces as a special character in a regex. Can someone help me with this? Source: AngularJS

How can I modify my regular expression below to block the repetition of characters (not to be repeated more that two times in continuation)?

Below is the regular expression I want to modify to check the repetition of characters for not more than 2 times in continuation, see the below examples for more details. I have the regex for avoiding the repetition but I need both of them in the same expression. (/(.){2}/) For example: Nameee : Invalid, Naaame : Invalid, Name : Valid, Naammee: Valid, Nnname : Invalid. I have ^(?!.*[AaEeIiOoUu]{5}).*[AaEeIiOoUu].*[a-zA-Zu00BF-u1FFFu2C00-uD7FF]*(?:-[a-zA-Zu00BF-u1FFFu2C00-uD7FF]*)?$ Source: AngularJS

test return false if upper case or number is present in a text

regexp I tried include follows(for upper case). The following returns true self.upperCharCheck = false ; //has to be false by default var temp =”(?=(.*[^A-Z]))”; self.testUpperCase = new RegExp(temp); self.upperCharCheck = (self.testUpperCase.test(self.newPassword)); I want the self.upperCharCheck to be true if no UpperCase is present and false otherwise if uppercase is present. Source: AngularJS

Restrict typing by RegExp in AngularJS

I coded an angular directive for inhibiting typing from inputs by specifying a regex. In that directive I indicate a regex that will be used for allow the input data. Conceptually, it works fine, but there are two bugs in this solution: In the first Plunker example the input must allow only numbers or numbers followed by a dot [.], or numbers followed by a dot followed by numbers with no more than four digits. […]

Next Page »