HTML5 has built-in pattern validation on INPUT fields which is based on regex.
- - May have some limitations around lookahead and lookbehind.
- + Recruits the browser in data validation, without script. Works with javascript disabled.
- + Easy to add to any field
- > - But regex's are inherently difficult to get right.
- Tips
- > Avoid leading ^ and trailing $, as a pattern string is already applied to the full string.
- > HTML attribute-encode your string before pasting it into the value.
- https://codepen.io/memetican/pen/RwyMjNp/b7c89c63a4d0298507a33eb3e877975e
-