Regex pattern ^(\+?6?01)[0|1|2|3|4|6|7|8|9]\-*[0-9]{7,8}$
in HTML5 input return error. I tested the regex, no errors on regex101.com as well as in my php code. But in HTML5 it does not function as it be. My code:
<input class="mdl-textfield__input" name="mobile_number" type="text" pattern="^(\+?6?01)[0|1|2|3|4|6|7|8|9]\-*[0-9]{7,8}$">
Error:
textfield.js:146 Pattern attribute value ^(+?6?01)[0|1|2|3|4|6|7|8|9]-*[0-9]{7,8}$ is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /^(+?6?01)[0|1|2|3|4|6|7|8|9]-*[0-9]{7,8}$/: Invalid escape
Anyone can help me? Thanks in advance for any helps offered.
My tested regex: https://regex101.com/r/1WsVwo/1