Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Ajax and PHP regular expression validation form and CAPTCHA

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you the "Ajax and PHP regular expression verification form and CAPTCHA example analysis", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let Xiaobian lead you to study and learn "Ajax and PHP regular expression verification form and CAPTCHA sample analysis" this article.

Pattern match:

\: escape characters such as:\ b escaped b

^: regular expression start symbol

$: regular expression end symbol

*: match the preceding character 0 or n times

+: matches the preceding character once or n times

?: match the preceding character 0 or 1 times

Matches all single characters except newline characters

| |: or, for example, x | y matches x or y |

{n}: matches the first n characters

{nrecoery m}: match at least n and up to m preceding characters

[xyz]: matches any character in parentheses

[^ xyz]: matching is equivalent to [0-9] except for any character in square brackets

\ w: matching any number or letter or underscore is equivalent to [A-Za-z0-9 _]

\ d: matches any number between 0Murray 9

Pattern modifier:

I: ignore case

Examples of common regular expressions:

/ / the user name consists of 6-18 alphanumeric underscores and cannot start with a number.

Var r_name=/ ^ [a-z]\ w {5pm 17} $/ I

/ / the password length cannot be less than six digits.

Var r_pwd=/ ^\ w {6,} $/

/ / all general email addresses

Var r_eamil=/ ^\ walled @\ w+ (\.)\ wrought /

/ / match an address of QQ Mail

/ / 861745122@qq.com

Var r_qq_email=/ ^\ d {5,} @ qq (\.) com$/

/ / match an email address of 163

Var r_163_email=/ ^\ way.163 (\.) com$/

/ / match a suffix name that may be .com | .net | .cn | .edu

Var email=/ ^\ walled @\ w+ (\.) com | net | cn | edu$/

/ / A valid age group is required

Var r_age=/ ^\ d {1pc2} $/

/ / if (age > = 18&&age "= 100)

/ / verify the mobile phone number: 11 digits at the beginning of 13 15 18

Var r_tel=/ ^ 1 [3pr 5pr 8]\ d {9} $/

/ / verify the ID number of 18 digits or 17 digits plus an X

Var r_s=/ ^\ d {18} |\ d {17} xgarbage I

/ / verify Chinese var reg=/ ^ [\ u4e00 -\ u9fa5] {2pr 17} $/

/ / php

$reg = "/ ^ [\ x {4e00} -\ x {9fa5}] $/ u"

The following is an example: account basic information login account: gender: male and female account security settings login password: real name: email address:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report