我正在尝试执行以下操作:
<input type="text" id="title" class="u-full-width" pattern="^(hi | hello)$" title "Some messege here">
现在我正在努力使正则表达式成为“hi”或“hello”,但出于某种原因,这个 or 语句不起作用。我需要逃避吗?字符,我试过了,但似乎也不起作用。
最佳答案
尝试删除空格,例如:
pattern="^(hi|hello)$"
关于javascript - HTML 中的正则表达式或,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56151322/