RegExp in Angular Tester
How do I make an regexp in angular tester?
Test Regular Expressions (RegExp) in Angular. What is a regexp in angular tester? How do you make a regexp in angular tester? This script and codes were developed by Robert on 04 September 2022, Sunday.
RegExp in Angular Tester - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>RegExp in Angular Tester</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div class="row" ng-controller="MainCtrl as main"> <h1 class="text-center">{{main.title}}</h1> <br> <form style ="margin: auto; width: 90%" name="testForm" novalidate> <div class="form-group"> <label>Regular Expression: </label> <input class="form-control" type="text" ng-model="main.regexp" ng-change="main.updateRE()" ng-required="true"/> </div> <h4>8 Sample RegExp(s) you should know (<a href="https://code.tutsplus.com/tutorials/8-regular-expressions-you-should-know--net-6149" target="_blank">Tuts Plus Tutorial</a>):</h4> <ol style="border:1px solid lightgray; border-radius: 5px; height: 290px; overflow-y: scroll;"> <li ng-repeat='sample in main.regExpSamples'><a href="javascript:" ng-click="main.selectRE(sample)"><img class="rePics" ng-src="{{sample.pic}}"/><strong>{{sample.exp}}</strong> - {{sample.desc}}</a></li> </ol> <div class="form-group"> <label>Match Regular Expression: </label> <input class="form-control failTest" type="text" ng-model="main.result" ng-change="main.checkInput()" ng-required="true" ng-class="{passTest:main.passTest}"/> </div> <blockquote>RegExp "<strong class="muted">{{main.regexpat}}</strong>" matches: {{main.resultOfRegEx}}</blockquote> </form> </div> <br /> <blockquote class="blockquote-reverse"> <p>Thank you <a href="https://code.tutsplus.com/tutorials/8-regular-expressions-you-should-know--net-6149" target="_blank">tutsplus.com</a> for this easy learn by example tutorial on Regular Expressions (aka RegExp).</p> <footer><cite title="Source Title">8 Sample Reg Expressions you should know</cite></footer>
</blockquote
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
RegExp in Angular Tester - Script Codes CSS Codes
a { cursor: pointer; text-decoration: none; color: black;
}
.failTest { background-color: pink; color: black;
}
.passTest { background-color: #00AEEF; color: white;
}
.rePics { margin: 2px; border: 1px solid lightgray; width: 128px;
}
.rePics:hover { width: 300px;
}
RegExp in Angular Tester - Script Codes JS Codes
(function () { angular.module("agentApp",[]) .controller("MainCtrl", MainCtrl) .controller("SampleCtrl", SampleCtrl) .filter("FilterName", FilterName) .directive("DirName", DirName) .factory("FactoryName", FactoryName); function MainCtrl($scope, FactoryName){ FactoryName.get(); this.title = FactoryName.name this.regExpSamples = FactoryName.samples; this.result = ''; this.resultOfRegEx = false; this.regexp = 'ab*c'; this.passTest = false; this.updateRE = function(){ try { this.regex = new RegExp(this.regexp,'i'); this.regexpat = this.regex.toString(); } catch (err) { this.resultOfRegEx = 'RegExp Error (' + err.message + ')'; } } this.checkInput = function(){ this.resultOfRegEx = this.regex.test(this.result); this.passTest = this.resultOfRegEx === true ? true : false; } this.selectRE = function(item){ this.regexp = item.exp; this.updateRE(); } this.updateRE(); } function SampleCtrl(){ } function FilterName(){ return function(){ return; } } function DirName(){ return { restrict: 'EA', template: [ '<a href="" class="myawesomebutton" ng-transclude>', '<i class="icon-ok-sign"></i>', '</a>' ].join(''), link: function ($scope, $element, $attrs) { // DOM manipulation/events here! $element.on('click', function () { $(this).addClass('test'); }); } }; } function FactoryName($http){ var FactoryService = {}; FactoryService.name = "Angular RegExp Tester"; FactoryService.samples = [ {exp: '^[a-z0-9_-]{3,16}$', desc: 'Matching a Username', pic:'https://cdn.tutsplus.com/net/uploads/legacy/404_regularExpressions/images/username.jpg'}, {exp: '^[a-z0-9_-]{6,18}$', desc: 'Matching a Password', pic: 'https://cdn.tutsplus.com/net/uploads/legacy/404_regularExpressions/images/password.jpg'}, {exp: '^#?([a-f0-9]{6}|[a-f0-9]{3})$', desc: 'Matching a Hex Value', pic: 'https://cdn.tutsplus.com/net/uploads/legacy/404_regularExpressions/images/hex-copy.jpg'}, {exp: '^[a-z0-9-]+$', desc: 'Matching a Slug', pic: 'https://cdn.tutsplus.com/net/uploads/legacy/404_regularExpressions/images/slug.jpg'}, {exp: '^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$', desc: 'Matching an Email', pic: 'https://cdn.tutsplus.com/net/uploads/legacy/404_regularExpressions/images/email.jpg'}, {exp: '^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$', desc: 'Matching a URL', pic: 'https://cdn.tutsplus.com/net/uploads/legacy/404_regularExpressions/images/url.jpg'}, {exp: '^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$', desc: 'Matching an IP Address', pic: 'https://cdn.tutsplus.com/net/uploads/legacy/404_regularExpressions/images/ip.jpg'}, {exp: '^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$', desc: 'Matching an HTML Tag', pic: 'https://cdn.tutsplus.com/net/uploads/legacy/404_regularExpressions/images/htmltag.jpg'} ] FactoryService.get = function(){ return FactoryService; } return FactoryService; } // https://docs.angularjs.org/guide/bootstrap Manual Initialization angular.bootstrap(document, ['agentApp']);
})();
Developer | Robert |
Username | AgentRR007 |
Uploaded | September 04, 2022 |
Rating | 3 |
Size | 3,618 Kb |
Views | 22,264 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Angular Template | 2,104 Kb |
Interface Animation | 3,829 Kb |
Angular Calendar Clock | 7,543 Kb |
Observing Cells | 2,788 Kb |
AgentRR007 Logo Rotate | 1,874 Kb |
CountDown | 4,688 Kb |
AngularJS 1.5 Demo | 3,373 Kb |
Santa, my house is over here... | 2,419 Kb |
FireBase Demo | 3,081 Kb |
DC Comic Slide Image | 3,262 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Comment Jquery | SquishyAndroid | 2,421 Kb |
Impress JS Algorhytmic Generator | Jeffscottward | 7,906 Kb |
Codero Sitemap | S1m0ne | 28,169 Kb |
Rrremark.com Overlay Highlighter | Derickruiz | 4,438 Kb |
Sassy Buttons | Elyseholladay | 2,299 Kb |
Project MMetro beta | Atomicsong | 5,157 Kb |
Ghost | Mghayour | 11,738 Kb |
Ipad Mini Showcase | Hornebom | 10,479 Kb |
NT Tribute | Skybutterfly | 2,850 Kb |
Drag in vanilla js using dotval math instead of translate | Paulq | 2,662 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!