Answer to the meaning of regular expression \w \d
I believe many people know about regular expressions, but many people’s first impression is that it is difficult to learn, because at first glance, they feel that there are no rules at all, and they are all a bunch of special features. Symbols are completely incomprehensible. In fact, it’s just because you don’t understand regular expressions. Once you understand them, you will find that that’s it. There are actually not many related characters used in regular expressions, and they are not difficult to remember, let alone understand. The only difficulty is the readability after combining them. It is relatively poor and not easy to understand. This article aims to give everyone a basic understanding of regular expressions, so that everyone can understand simple regular expressions and write simple regular expressions to meet the needs of daily development. .
What is a regular expression
A regular expression is a special string pattern used to match a set of strings. It's like using a mold to make a product, and regular rules are this mold, defining a rule to match characters that match the rules.
After consulting many related regular descriptions, I found that the definition of \w refers to containing uppercase and lowercase letters, numbers and underscores, which is equivalent to ([0-9a-zA-Z])
(Based on the classic regular expression 30-minute introductory tutorial)
However, in actual use, it is found that this is not the case. It can also be said that it actually includes more than just ([0-9a -zA-Z_])
These data,
The following is the test screenshot tool for editplus:
actually except ([0 -9a-zA-Z_])
also includes Greek letters, Russian letters, etc.;
So if you need to pay attention to the specific matching data when registering user information, you must not use it directly \w Done
PS: Let’s look at the regular expression \w \s \d \b
. Matches any character except newline characters
\w Matches letters or numbers or underscores or Chinese characters, which is equivalent to '[^A-Za-z0-9_]'.
\s Matches any whitespace character
\d Matches digits
\b Matches the beginning or end of a word
^ Matches the beginning of a string
$ Match the end of the string
\wWhether Chinese characters can be matched depends on your operating system and your application environment
The above content is the regular expression\w The answer to the meaning of \d, I hope it can help everyone.
Related recommendations:
Understanding of \b in regular expressions
Summary of regular expressions commonly used in PHP forms
Summary of commonly used regular expressions
The above is the detailed content of Answer to the meaning of regular expression \w \d. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











As a programming language that has become very popular in recent years, Go language has become a hot spot for interviews in many companies and enterprises. For beginners of the Go language, how to answer relevant questions during the interview process is a question worth exploring. Here are five common Go language interview questions and answers for beginners’ reference. Please introduce how the garbage collection mechanism of Go language works? The garbage collection mechanism of the Go language is based on the mark-sweep algorithm and the three-color marking algorithm. When the memory space in the Go program is not enough, the Go garbage collector

Ethereum has continued to develop since its birth. The previously completed Cancun upgrade is a phased upgrade of Ethereum aimed at improving the scalability, security and sustainability of the Ethereum network. Although the Cancun upgrade is an important milestone for Ethereum 2.0, it does not mean that the upgrade work has been completed. The subsequent Ethereum 2.0 is still in the stage of development and improvement. Therefore, what upgrades will the currency circle expect after the upgrade of Cancun? Attracting much attention, official statements stated that after the Cancun upgrade is officially implemented in 2024, the Goerli test network will no longer be used, and there are no specific plans for subsequent upgrades. Next, the editor will tell you in detail. What other upgrades have there been to Cancun? There are no specific plans for other upgrades after the Cancun upgrade. In addition, according to the latest news, Ethereum Cancun upgrade 20

PHP7 has added a new operator double question mark (??) operator. In PHP7, the double question mark (??) operator is called the NullCoalescing operator. If the first operand exists and is not NULL, the first operand is returned; otherwise, the second operand is returned. It is evaluated from left to right. The NullCoalescing operator can also be used in chained format. Let us demonstrate the double question mark (??) operator with the following example. Example<?php //$aisnotset echo$a??9??45;?&am

What’s the meaning of Thank You Bubble? Some friends are very interested in this meme, but don’t know what it means. Below I will introduce the meaning of the thank you bubble meme. Come and take a look. What is the meme of Thank You Bubble? This is actually an emoticon meme. It means that Bubble brings a glass of warm water. It hopes you will be healthy and not get sick. Say "Thank you Bubble" quickly. The meaning of the Thank You Bubble meme is that Bubble has brought something good, I hope you can say "Thank you Bubble". Thank you Bubble emoticon pack This is Bubble, it brings a glass of warm water, it hopes you will be healthy and not sick, please say "Thank you Bubble". This is Carl. Carl brought you a glass of water. Carl hopes that you must stay hydrated no matter what. Drink the glass of water and say: Thank you Carl for the water.

CentOS file system FAQ The file system is a crucial component in using the CentOS operating system. It is responsible for storing, organizing and managing files and directories, and plays a vital role in the stable operation of the system and data security. However, inevitably, you will encounter some common problems when using file systems. This article will answer common questions about the CentOS file system, hoping to help readers better understand and deal with these problems. Question 1: How to check the usage of file system

The Linux operating system is an open source operating system known for its stability, security and flexibility. In Linux systems, the Home directory is the default working directory for each user after logging in, and is also the place where the user's personal files and settings are stored. The role and significance of the Home directory is very important. This article will explore the role and significance of the Linux Home directory. First, the Home directory provides each user with a private space for storing personal files and settings. Each user has a unique

LinuxGem: The shining pearl in the open source world. In recent years, with the rapid development of open source software, Linux systems have become the platform of choice for more and more software developers and IT practitioners. Linux is widely popular in the field of server-side and embedded devices due to its stability, security and flexibility. In the huge ecosystem of Linux, there are many shining pearls, one of which is LinuxGem. This article will explore the significance and value of LinuxGem and provide specific code examples. Linux

The role and significance of Request in PHP In PHP programming, Request is a mechanism for sending requests to the Web server. It plays a vital role in Web development. Request is mainly used to obtain data sent by the client, such as form submission, GET or POST request, etc. Through Request, the data input by the user can be obtained, and the data can be processed and responded to. This article will introduce the role and significance of Request in PHP and give specific code examples.
