Basic syntaxA regular expression is often referred to as a pattern, which is used to describe or match a series of strings that conform to a certain syntactic rule.One, select:|
| Vertical separators indicate selections, such as "Boy|girl"
The following is about the small series for everyone to collect and organize the regular expression of PHP, the specific content please see below detailed
$str = Preg_replace ("/() (. *?) ()/", ' \1\2\3 ', $str);
It uses three sub
Mixed preg_replace (mixed pattern, mixed replacement, mixed subject [, int limit])FunctionSearches the subject for a match in pattern mode and replaces it with replacement. If limit is specified, only the limit match is replaced, and if the limit is
A regular expression is a text mode consisting of common characters (such as characters A to Z) and special characters (such as metacharacters. This mode describes one or more strings to be matched when searching the text subject. A regular
A regular expression is a text pattern that includes common characters (for example, letters between A and Z) and special characters (called"Metacharacters"). Mode description one or more strings to be matched when searching text.Regular Expression
A regular expression is a text mode consisting of common characters (such as characters a to z) and special characters (such as metacharacters. This mode describes one or more strings to be matched when searching the text subject. A regular
Character
Description
/
Mark the next character as a special character, a literal character, or a backward reference, or an octal escape character. For example, 'n' matches the character "N ". '/N' matches a line break. The sequence '/
JS Regular Expression
// Check whether it is composed of digits[Code] function isdigit (s) {var patrn =/^ [0-9] {1, 20} $/; If (! Patrn.exe C (s) return false return true} [/Code]
// Check Logon Name: You can enter only 5-20 strings starting with a
Regular Expression example
Expression
Match
/^/S * $/
Matches empty rows.
// D {2}-/d {5 }/
The ID number consists of two digits, one hyphen and five digits.
/] *)?> [/S] * /
Matches HTML tags.
// Check whether it is composed of digits[Code] function isDigit (s) {var patrn =/^ [0-9] {1, 20} $/; if(! Patrn.exe c (s) return false return true} [/code]
// Check Logon Name: You can enter only 5-20 strings starting with a letter, which can
Character
Description
\
Mark the next character as a special character, text, reverse reference, or octal escape character. For example, "n" matches the character "n ". "\ N" matches the line break. The input character \. * +? | () {}^ $, Which must
Conversion from: Dream DOTNET
A regular expression is a text mode consisting of common characters (such as characters A to Z) and special characters (such as metacharacters. This mode describes one or more strings to be matched when searching the
Data verification is very common in both C/S and B/S. In the past, we liked to use a bunch of if... else... determine whether the input content meets the requirements.
Many languages now support regular expressions, which define a set of their own
Java regular expression syntax
Regular expression syntax
A regular expression is a text pattern that includes common characters (for example, letters between A and Z) and special characters (referred to as "metacharacters "). Mode description one or
Replace () is a simple replacement of characters.
ExampleCodeAs follows:
It only replaces the first letter. However, if you add a regular expression, the results will be different! Replace () supports regular expressions. It can match
The RegExp object and String object in JavaScript define a method that uses regular expressions to execute powerful pattern matching and text retrieval and replacement functions.
In JavaScript, regular expressions are represented by a RegExp object.
In the process of developing automated test scripts, it is a good solution to use regular expression fuzzy matching to solve the recognition and validation of property-like objects, and there are too many regular expression categories to summarize
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.