Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Commit 786e80e

Browse files
committed
Fixed issue #63 make custom Regex pattern greedy
Custom Regex pattern was non-greedy and was causing problem when user had a '/' inside his own custom pattern.
1 parent d475e27 commit 786e80e

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-validation-ghiscoding",
3-
"version": "1.4.4",
3+
"version": "1.4.5",
44
"author": "Ghislain B.",
55
"description": "Angular-Validation Directive and Service (ghiscoding)",
66
"main": [

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Angular-Validation change logs
22

3+
1.4.5 (2015-09-03) Fixed issue #63 - Custom Regex pattern should be greedy (instead of non-greedy), this was causing a problem when user add a `/` in his pattern and was stopping on first occurence.
34
1.4.4 (2015-08-21) Enhancement #59 - Added few Validators that are like Laravel for reusability. The `in` and `not_in` Validators are the most interesting.
45
1.4.3 (2015-08-18) Fixed issue #58 - multiple ControllerAs with Route change giving error of 'undefined' on $validationSummary.
56
1.4.2 (2015-08-09) Fixed Bootstrap UI (or any other tool) interference with Angular-Validation, in relation to issue #55.

dist/angular-validation.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-validation-ghiscoding",
3-
"version": "1.4.4",
3+
"version": "1.4.5",
44
"author": "Ghislain B.",
55
"description": "Angular-Validation Directive and Service (ghiscoding)",
66
"main": "app.js",

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Angular Validation (Directive / Service)
2-
`Version: 1.4.4`
2+
`Version: 1.4.5`
33
### Form validation after user inactivity of default 1sec. (customizable timeout)
44

55
Forms Validation with Angular made easy! Angular-Validation is an angular directive/service with locales (languages) with a very simple approach of defining your `validation=""` directly within your element to validate (input, textarea, etc) and...that's it!!! The directive/service will take care of the rest!
@@ -8,7 +8,7 @@ The base concept is not new, it comes from the easy form input validation approa
88

99
For a smoother user experience, I also added validation on inactivity (timer/debounce). So validation will not bother the user while he is still typing... though as soon as the user pauses for a certain amount of time, then validation comes into play. It's worth knowing that this inactivity timer is only available while typing, if user focuses away from his input (onBlur) it will then validate instantly.
1010

11-
Supporting AngularJS 1.3.x *(current code should work with 1.2.x just the same, but is no more verified)*
11+
Supporting AngularJS 1.3/1.4 branch *(current code should work with 1.2.x just the same, but is no more verified)*
1212

1313
Now support <b>Service</b> using the same functionalities as the <b>Directive</b>.
1414
Huge rewrite to have a better code separation and also adding support to Service functionalities. Specifically the `validation-rules` was separated to add rules without affecting the core while `validation-common` is for shared functions (shared by Directive/Service).

src/validation-common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ angular
119119
// We first need to see if the validation holds a custom user regex, if it does then deal with it first
120120
// So why deal with it separately? Because a Regex might hold pipe '|' and so we don't want to mix it with our regular validation pipe
121121
if(rules.indexOf("pattern=/") >= 0) {
122-
var matches = rules.match(/pattern=(\/.*?\/[igm]*)(:alt=(.*))?/);
122+
var matches = rules.match(/pattern=(\/.*\/[igm]*)(:alt=(.*))?/);
123123
if (!matches || matches.length < 3) {
124124
throw 'Regex validator within the validation needs to be define with an opening "/" and a closing "/", please review your validator.';
125125
}

0 commit comments

Comments
 (0)