-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Issue with ng-pattern #11917
Comments
This is because Using /(\w+\s*)+/ --> Matches as long as there is at least 1 word-character
followed by 0 or more whitespace-characters
/^(\w+\s*)+$/ --> Matches as long as the input consists exclusively of sequences
of at least 1 word-character followed by 0 or more whitespace-characters
'(\w+\s*)+' --> Equivalent to the above (because `ngPattern` wraps it
in `^...$` automatically, but (negligibly) less performant |
/cc @petebacondarwin |
@gkalpak Thanks for the suggestions. It helps. |
I think this should just be documented as a weird case that should be avoided. I don't see why you would want to add a g modifier when using ngPattern but I don't think we should be the ones to remove it. |
Add a note to point out that using the `g` flag on the validation RegExp, will cause each search to start at the index of the last search's match, thus not taking the whole input value into account. Closes angular#11917
Add a note to point out that using the `g` flag on the validation RegExp, will cause each search to start at the index of the last search's match, thus not taking the whole input value into account. Closes angular#11917
Add a note to point out that using the `g` flag on the validation RegExp, will cause each search to start at the index of the last search's match, thus not taking the whole input value into account. Closes angular#11917 Closes angular#11928
Add a note to point out that using the `g` flag on the validation RegExp, will cause each search to start at the index of the last search's match, thus not taking the whole input value into account. Closes angular#11917 Closes angular#11928
I have an issue with ng-pattern. It works perfectly when adding characters to the input, it vaildates and shows error when invalid but acts weirdly while deleting characters from the input even if its is a valid string. If you delete a character from the input it show invalid and if you delete one more character it shows it as a valid. this repeats for every character you delete.
I observed this issue in 1.2.18, 1.3.15 and 1.4.0.rc2
I have added an example in the plunker.
http://plnkr.co/edit/A4kHHthnEYzaxyVzu7w9?p=preview
The text was updated successfully, but these errors were encountered: