Js code

<script type="text/javascript">
function SubmitCk() {
var reg = /^([a-zA-Z0-9]+[_|\_|\.]?) *[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?) * [a zA - Z0-9] + \. [a zA - Z] {2, 3} $/;
if(! reg.test($("#txtEmail").val())) {
alert("Please enter the correct email address")
return false;
}
}
</script>
Copy the code
  • A set of regular expressions that validate numbers
  • Verification number: ^[0-9]*$
  • Verify n digits: ^\d{n}$
  • Verify at least n digits: ^\d{n,}$
  • Verify m-n digits: ^\d{m,n}$
  • Verify the number of zero and non-zero start: ^ (0 | 1 – [9] [0-9] *) $
  • Verify positive real numbers with two decimal places: ^[0-9]+(.[0-9]{2})? $
  • Verify positive real numbers with 1-3 decimal places: ^[0-9]+(.[0-9]{1,3})? $
  • Verify non-zero positive integers: ^+? [1-9] [0-9] * $
  • Validates non-zero negative integers: ^-[1-9][0-9]*$
  • Validates non-negative integers (positive integers + 0) ^\d+$
  • Verify the positive integer (negative integers + 0) ^ ((\ d +) | (0 +)) $
  • Verify characters of length 3: ^.{3}$
  • Validates A string of 26 English letters: ^[A-za-z]+$
  • Verify A string of 26 uppercase English letters: ^[a-z]+$
  • Validates a string of 26 lowercase letters: ^[a-z]+$
  • Validates A string of numbers and 26 letters: ^[A-zA-z0-9]+$
  • Validates a string consisting of numbers, 26 letters, or underscores: ^\w+$
  • Verify user password :^[a-za-z]\w{5,17}$the password must start with a letter and contain between 6 and 18 characters, digits, and underscores (_).
  • Verify if it contains ^%&’,; =? \” and other characters: [^%&’,;=?\x22]+
  • ^[\ U4E00-\ u9FA5],{0,}$
  • Verify Email address: /^([A-zA-Z0-9]+[| _ |.]?) *[a-zA-Z0-9]+@([a-zA-Z0-9]+[| _ |.]?) * [a zA – Z0-9] +. [a zA – Z] {2, 3} $/
  • Verify InternetURL: ^http://([\w-]+.) +[\w-]+(/[\w-./?%&=]*)? ; [a – zA – z] + : / / (w + (+) – w ∗) (. (w + (+) – w ∗)) ∗ (? S ∗)? ; ^[a-zA-z]+://(w+(-w+)*)(.(w+(-w+)*))*(? S*)? ; [a – zA – z] + : / / (w + (+) – w ∗) (. (w + (+) – w ∗)) ∗ (? S ∗)?
  • Verify the telephone number: ^ ((\ d {3, 4}) | \ d {3, 4} -)? \d{7,8}$: — the correct format is xxxx-xxxxxxx, xxxx-xxxxxxxx, xxx-xxxxxxx, xxx-xxxxxxxx, XXXXXXX, XXXXXXXX.
  • Verify identification number (15 or 18 digit) : ^ \ d {15} | \ d {} $18
  • Verify 12 months of the year: ^(0? [1-9] | 1 [2-0]) $correct format for: “01” – “09” and “1” “12”
  • Verify 31 days of a month: ^((0? [1-9]) | | 2 (1) ([0-9]) | | 31) $30 correct format is: 01, 09 and 1, 31.
  • Integer: ^ -? \d+$
  • Non-negative floating-point (positive floating-point + 0) : ^\d+(.\d+)? $
  • Positive float ^(([0-9]+.[0-9][1-9] [0-9]) | ([0-9][1-9] [0-9][0-9] +) | ([0-9][1-9] [0-9])) $
  • Non-positive float (negative float + 0) ^((-\d+(.\d+)?) | ((. 0 0 + +)?) ) $
  • Negative float ^(-(([0-9]+.[0-9][1-9] [0-9]) | ([0-9][1-9] [0-9][0-9] +) | ([0-9][1-9] [0-9]))) $
  • Floating-point ^ (-? \d+)(.\d+)? $

Nature’s porters, www.iteye.com/blog/lives-…