I've been working on creating a form that can accept Twitter parameters like # and @ to display a Twitter feed.
Initially, I intended to use the ng-pattern
directive in Angular.js to validate the input before saving. However, the validation process is behaving oddly. It marks a correctly formatted string as invalid every second character while typing.
Describing this strange behavior is quite challenging, so you can check out the issue on this Plunker.
To provide more context, below is my input field containing the peculiar ng-pattern
:
<input type="text" ng-pattern="/(^|\s)@(\w+)|(^|\s)#(\w+)/g" ng-model="foo" name="foo"/>