Regular expression, also known as regular expression, regular expression, regular expression, regular expression, regular expression (English: Regular Expression, often abbreviated as regex, regexp or RE in code).
Regular expressions use a single string to describe and match a series of strings that match a certain syntax rule. In many text editors, regular expressions are often used to retrieve and replace text that matches a certain pattern.
1. Character class
1. Character class: can match any character it contains
eg: /[abc]/ matches any one of the letters "a", "b", and "c"
2. Negative character class: Define the negative character class through the "^" character, which matches all characters not contained in square brackets. When defining a negative character class, put a "^" symbol as the first character inside the left bracket.
eg:/[^abc]/ matches all characters except "a", "b", and "c".
3. \s: matches spaces, tabs and other Unicode whitespace characters;
. : Any character except newlines and other Unicode line terminators.
All resources on this website are contributed and published by netizens, or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this website are for learning and reference only. Please do not use them for commercial purposes, otherwise you will be responsible for all consequences incurred! If there is any infringement, please contact us to delete and remove it. Contact information: admin@php.cn