Regular expressions are always useful in programming, and in personal cognition, the following programming languages are used, of course:(1) Web front end: JavaScript(2) Web backend: ASP, JSP, PHP(3) Mobile: Android, IOSSome basic descriptions and
I believe that no matter the great God or the food birds, they recognize printf. And his family and his brother Sprintf,scanf,sscanf...$^&*.when you're gorgeous write down char c='C';p rintf ("char=%d", c), when everything is still so beautiful. But
The use of regular expressions is detailedBrief introductionSimply put, regular expressions are a powerful tool that can be used for pattern matching and substitution. The function is as follows:Tests a pattern for a string. For example, you can
non-printable characters
Character meaning
\CX matches the control character indicated by X. For example, \cm matches a control-m or carriage return. The value of x must be one of a-Z or a-Z. Otherwise, c is treated as a literal ' C ' character.
\f
If you want to remove whitespace from the beginning and end of the string, you can use the PHP internal function trim (). However, we often want to completely clear the blanks. You need to clear the opening and closing blanks, turn multiple
This article mainly describes the PHP preg_replace () regular replacement of all strings matching the method, has a certain reference value, now share to everyone, the need for friends can refer to
PHP preg_replace () Regular substitution, unlike
\b: To find the word hi accurately, we should use \bhi\b . : Matches any character except line break*: Matches any time\d: Matching numbers\s: Matches any whitespace character, including spaces, tabs (tab), line breaks, Chinese full-width spaces,
Character
Describe
\
The next character is marked with a special character, or a literal character, or a back reference, or an octal escape character. For example, ' n ' matches the character "n". ' \ n ' matches a line break.
Regular expressions (regular expression, referred to as regex) are a tool.Two basic uses of regular expressions: find and replace.. the character (period) can match any single character. (. Characters can match any single character, number, letter,
Many web developers can work smoothly after ignoring regular expressions, but in many cases a correct regular expression is likely to omit the half-screen code.
The interpretation of regular expressions
Terminology
Basic Regular expressions can be used to retrieve, select, edit, and validate strings that conform to certain characteristics. It's very versatile, many programming languages provide support for regular expressions at the language level or in
Introduction to 1.re the use of the Python re module, although not sufficient to meet all the complex matching situation, but enough in most cases to effectively implement the analysis of complex strings and extract relevant information. Python
One, what can this do?
Tests the pattern within a string.For example, you can test the input string to see if there is a phone number pattern or credit card number pattern within the string. This is called data validation.
One, form security
1. Htmlspecialchars () function
Converts a special character to an HTML entity. This means that HTML characters such as are replaced with . This prevents attackers from exploiting the code by injecting HTML or JavaScript code
1. Basic knowledge of regular expressionsMeaning: A string pattern consisting of ordinary characters and (A-Z) and some special character
function: Validation.
Replace the text.
Extracts a substring from a string.
Category: POSIX and Perl
POSIX
[Regular expression] text box input content controlInteger or decimal: ^[0-9]+\. {0,1} [0-9] {0,2}$Only numbers can be entered: "^[0-9]*$".Only n digits can be entered: "^\d{n}$".Only numbers with at least n digits can be entered: "^\d{n,}$".You can
I. Regular Expressions-Introductory article1. Meta-characters, and common examples. Matches any character except the Terminator, and in some cases does not match the line start character^ Start of matching line^the matches the line that preceded the$
Self-understanding concept : Customize the rules to match exactly the characters or strings you want, while excluding characters or strings that you don't want to match.Metacharacters\b matches the beginning or end of a word, that is, the boundary
1. Regular grammar
character
Description
\
Marks the next character as a special character, text, reverse reference, or octal escape. For example, "n" matches the character "n". "\ n" matches the line break. The
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.