简体   繁体   English

在html输入字段中使用哪种模式来验证法语数字格式?

[英]What pattern to use in a html input field to validate french numbers format?

I am looking for the right pattern allowing to validate french numbers (positive integers) in an HTML input. 我正在寻找允许在HTML输入中验证法语数字(正整数)的正确模式。

ie thousand separator is a "space". 即千位分隔符是一个“空格”。

Ex. 防爆。 of correct values: 正确值:

  • 1 1
  • 12 345 12345
  • 1 234 567 1234567
  • Ex. 防爆。 of incorrect: 的不正确:

  • 12x 12X
  • 2x1 2×1
  • 1237 1237
  • I have tried the pattern bellow, but it does not work 我已经尝试过波纹管模式,但是它不起作用

    <input pattern="([0-9]*[ ]*)*"/>

    Thanks for your help 谢谢你的帮助

    try this - 尝试这个 -

    <input pattern="[0-9 ]+"/>
    

    Note: there is a space before ] 注意: ]前有一个空格

    in javascript you can get actual number by replacing all " "(spaces) with "" and converting the string to integer 在javascript中,您可以通过将所有“”(空格)替换为“”并将字符串转换为整数来获取实际数字

    声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM