HTML example showing regular validation form

高洛峰
Release: 2017-03-11 11:45:02
Original
1106 people have browsed it

This article mainly introduces the example code of HTML using regular expressions to check tables. The code is simple and easy to understand, very good, and has reference value. Friends who need it can refer to it.

Let me share with you the HTML code. Example code of the regular expression check table. The specific code content is as follows:


 正则表达式在JavaScript脚本中是很好用的检验语法规则的方法。但是与Java中的正则表达式有所不同。它需要在regex规则上以“^”开始,以"$"结束。
Copy after login


以下让我们看看一个实例。
Copy after login


    Title   
  
登录名: 长度大于八位
登录密码: 长度大于十位,包含字母数字
确认密码:
身份证号码: 15位或18位最后一个是X
固定电话: 格式xxxx-xxxxxxx
手机号码: 11位整数
电子邮件: xxxx@xxx.xxx xxx@xxx.xxx.xx
现居住地:
Copy after login

Attachment: Some commonly used rules:

"^\\d+$" //Non-negative integer (positive integer + 0)

" ^[0-9]*[1-9][0-9]*$" //Positive integer

"^((-\\d+)|(0+))$" //Non-positive integer (negative integer + 0)

"^-[0-9]*[1-9][0-9]*$" //Negative integer

"^-?\\d+$" //Integer

"^\\d+(\\.\\d+)?$" //Non-negative floating point number (positive Floating point + 0)

"^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0- 9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$" // Positive Floating point number

"^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$" //Non-positive floating point Point number (negative floating point number + 0)

"^(-(([0-9]+\\.[0-9]*[1-9][0-9]*) |([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)) )$"  //Negative floating point number

"^(-?\\d+)(\\.\\d+)?$"  //Floating point number

"^[A-Za-z]+$" //A string consisting of 26 English letters

"^[A-Z]+$" //A string consisting of 26 English letters in uppercase The string

"^[a-z]+$" //A string consisting of 26 lowercase English letters

"^[A-Za-z0 -9]+$" // A string consisting of numbers and 26 English letters

"^\\w+$" // A string consisting of numbers, 26 English letters or underscores

"^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+ )+$" //email address

"^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+ (-\\w+)*))*(\\?\\S*)?$" //url

The above is an example of HTML using regular expressions to check tables introduced by the editor. Code, I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for your support of the Script House website!

The above is the detailed content of HTML example showing regular validation form. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!