【问题标题】:Pattern for an input Validation that checks 2 letters after dot检查点后 2 个字母的输入验证模式
【发布时间】:2020-01-30 07:15:09
【问题描述】:

我有一个输入,我写了一个获取域名的模式。它运作良好,但我想在 Dot 之后检查 2 个字母。如果我的域名在点后少于 2 个字母,我想显示一个错误。

这是我的代码:

    <form>
    <input type="text" name="Domainname" pattern="[a-zA-Z]+\.[a-zA-Z]+">
    <button type="submit"> check</button>
    </form>

【问题讨论】:

    标签: javascript jquery html regex


    【解决方案1】:

    使用{2,} 而不是最后一个+

    【讨论】:

      猜你喜欢
      • 2017-10-03
      • 1970-01-01
      • 1970-01-01
      • 2020-06-11
      • 2011-04-12
      • 2020-03-26
      • 2018-08-30
      • 2017-04-04
      • 1970-01-01
      相关资源
      最近更新 更多