Home > Web Front-end > JS Tutorial > Summary of commonly used regular expressions

Summary of commonly used regular expressions

一个新手
Release: 2017-09-30 09:11:23
Original
1836 people have browsed it

Commonly used regular expressions:

 /^\w+([-+.']\w+)*\w+([-.]\w+)*\.\w+([-.]\w+)*$/ :电子邮箱
  /^1[0-9]{10}$/ : 手机号码11位
  /^(1[0-9]{10}|\w+([-+.']\w+)*\w+([-.]\w+)*\.\w+([-.]\w+))*$/ : 手机号码11位或者是电子邮箱
Copy after login

 ^[0-9a-zA-Z]+$: can only be pure numbers, pure letters or a combination of numbers and letters

 ^(?!\d+$)[\da-zA-Z]*$: It cannot be pure numbers, it can be pure letters, or it can be a combination of letters and numbers


var da = /^[0-9a-zA-Z]+$/;if (!da.test("需要匹配的字符串"))
{
  layer.tips('请输入数字和字母组合', $(this), { tips: [1, '#3595CC'], time: 4000 });
  Success = false;
}
Copy after login

The above is the detailed content of Summary of commonly used regular expressions. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template