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

Commit

Permalink
Fixed issue #63 make custom Regex pattern greedy
Browse files Browse the repository at this point in the history
Custom Regex pattern was non-greedy and was causing problem when user
had a '/' inside his own custom pattern.
  • Loading branch information
ghiscoding committed Sep 4, 2015
1 parent d475e27 commit 786e80e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-validation-ghiscoding",
"version": "1.4.4",
"version": "1.4.5",
"author": "Ghislain B.",
"description": "Angular-Validation Directive and Service (ghiscoding)",
"main": [
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Angular-Validation change logs

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.
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.
1.4.3 (2015-08-18) Fixed issue #58 - multiple ControllerAs with Route change giving error of 'undefined' on $validationSummary.
1.4.2 (2015-08-09) Fixed Bootstrap UI (or any other tool) interference with Angular-Validation, in relation to issue #55.
Expand Down
6 changes: 3 additions & 3 deletions dist/angular-validation.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-validation-ghiscoding",
"version": "1.4.4",
"version": "1.4.5",
"author": "Ghislain B.",
"description": "Angular-Validation Directive and Service (ghiscoding)",
"main": "app.js",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Angular Validation (Directive / Service)
`Version: 1.4.4`
`Version: 1.4.5`
### Form validation after user inactivity of default 1sec. (customizable timeout)

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!
Expand All @@ -8,7 +8,7 @@ The base concept is not new, it comes from the easy form input validation approa

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.

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

Now support <b>Service</b> using the same functionalities as the <b>Directive</b>.
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).
Expand Down
2 changes: 1 addition & 1 deletion src/validation-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ angular
// We first need to see if the validation holds a custom user regex, if it does then deal with it first
// 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
if(rules.indexOf("pattern=/") >= 0) {
var matches = rules.match(/pattern=(\/.*?\/[igm]*)(:alt=(.*))?/);
var matches = rules.match(/pattern=(\/.*\/[igm]*)(:alt=(.*))?/);
if (!matches || matches.length < 3) {
throw 'Regex validator within the validation needs to be define with an opening "/" and a closing "/", please review your validator.';
}
Expand Down

0 comments on commit 786e80e

Please sign in to comment.