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规则上以“^”开始,以"$"结束。
以下让我们看看一个实例。
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!