• Welcome to Baben's blog that year. I'm glad to meet you at the right age!
  • Due to the theme, the QQ login partner displays the default avatar in the comments. Please go to the personal center to upload the avatar again.

Regular expressions I used in those years

Code Notes barben Four years ago (2019-12-17) 2607 views 0 comments
Can only be numbers and commas /^[\d,]*$/
Verify that the phone number is basically correct /^1[345789]\d{9}$/
Enter multiple mobile phone numbers. Each mobile phone number is separated by a comma. Commas cannot appear at the beginning and end /^(1(3|4|5|7|8)\d{9})(,(1(3|4|5|7|8)\d{9}))*$/
The password length is 6-18 digits, and there are at least two types of numbers, letters and symbols /(?!^[0-9]+$)(?!^[A-z]+$)(?!^[^A-z0-9]+$)^[^\s\u4e00-\u9fa5]{6,18}$/
The verification URL must start with lower case http or https /(http|https):\/\/([\w.]+\/?)\S*/
Verify the correct URL, with or without http or https /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|www\.)(([A-Za-z0-9-~]+)\.)+ ([A-Za-z0-9-~\/])+$/
Verify whether the ID card number is correct (must meet 18 digits and the date of birth must be correct) /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/
Verify whether the amount is correct (the minimum unit is minutes) /^(([^0][0-9]+|0)\. ([0-9]{1,2})$)|^(([^0][0-9]+|0)$)|^(([1-9]+)\. ([0-9]{1,2})$)|^(([1-9]+)$)/
Match HTML tags /<\/?.+?>/

Eight blogs that year, we have been
If the author does not indicate that it is an original article, please indicate the link and source of this article for reprinting
Regular expressions I used in those years- https://www.barben.cn/code/655.html
Like( eleven )
Post my comments
Cancel comment
expression Mapping Bold Strike through Center Italic

You need to bring your nickname and email with you in the review of Eight Books that year!

  • Nickname (required)
  • Email (required)
  • website