| regular character | Description |
|---|---|
| \ | Marks the next character as a special character, or a literal character, or a backward reference, or an octal escape character. For example,"nmatch charactern"。"\nMatches a line break. Serial\\"匹配"\And\(then match("。 |
| ^ | The start position of the match input string. If the Multiline property of the RegExp object is set, ^ also matches"\nor\rposition after. |
| $ | Match the end position of the input string. If the Multiline property of the RegExp object is set, $also matches"\nor\rprevious position. |
| * | Matches the preceding subexpression zero or more times. For example, zo * can match"zandzoo. * is equivalent to {0,}. |
| + | Matches the preceding subexpression one or more times. For example,"zo+can matchzoandzoobut cannot matchz. Equivalent to {1,}. |
| ? | Matches the preceding subexpression zero or once. For example,"do(es)?can matchdoesordoesin thedo.? Equivalent to {0,1}. |
| {n} | nis a non-negative integer. match determinednTimes. For example,"o{2}Can't matchBobin theo, but can matchfoodThe two o's. |
| {n,} | nis a non-negative integer. At least match.nTimes. For example,"o{2,}Can't matchBobin theobut can matchfooooodAll of the o's.o{1,}equivalento+"。"o{0,}is equivalento*"。 |
| {n,m} | mandnare non-negative integers, wheren<=m. Minimum MatchnTimes and most matchesmTimes. For example,"o{1,3}will matchfoooooodThe first three o's.o{0,1}equivalento?. Note that there can be no space between a comma and two numbers. |
| ? | When the character immediately follows any other qualifier (*, ,?,{n},{n,},{n,m}) later, the matching pattern is non-greedy. The non-greedy pattern matches the searched string as little as possible, while the default greedy pattern matches the searched string as much as possible. For example, for the string"oooo","o+?Will match singleo, ando+Will match allo"。 |
| . | Match except"\nAny single character other. To match include\nAny characters included, please use something like(.|\n)The mode. |
| (pattern) | Match the pattern and get the match. The obtained matches can be obtained from the generated Matches set, using the SubMatches set in the VBScript and the $0... $9 attribute in the JScript. To match the parenthesis character, use the\(or\)"。 |
| (?:pattern) | The match pattern but does not get the match result, that is, it is a non-get match and is not stored for later use. This is used in the or character"(|)It is useful to combine the parts of a pattern. For exampleindustr(?:y|ies)is a ratioindustry|industriesMore simple expression. |
| (?=pattern) | Forward positive pre-lookup, matching the lookup string at the beginning of any matching pattern string. This is a non-fetching match, that is, the match does not need to be fetched for later use. For example,"Windows(?=95|98|NT|2000)can matchWindows2000in theWindowsbut cannot matchWindows3.1in theWindows. The pre-check does not consume characters, that is, after a match occurs, the search for the next match starts immediately after the last match, rather than starting after the character that contains the pre-check. |
| (?!pattern) | Positive negative prelookup matches the lookup string at the beginning of any string that does not match the pattern. This is a non-fetching match, that is, the match does not need to be fetched for later use. For example"Windows(?!95|98|NT|2000)can matchWindows3.1in theWindowsbut cannot matchWindows2000in theWindows. The pre-check does not consume characters, that is, after a match occurs, the search for the next match starts immediately after the last match, rather than starting after the character that contains the pre-check. |
| (?<=pattern) | Reverse positive pre-check, and forward positive pre-check analogy, but in the opposite direction. For example,"(?<=95|98|NT|2000)Windowscan match2000Windowsin theWindowsbut cannot match3.1Windowsin theWindows"。 |
| (?<!pattern) | Reverse negative pre-check, and positive negative pre-check analogy, but in the opposite direction. For example"(?<!95|98|NT|2000)Windowscan match3.1Windowsin theWindowsbut cannot match2000Windowsin theWindows"。 |
| x|y | matches x or y. For example,"z|foodcan matchzorfood"。"(z|f)oodthen matchzoodorfood"。 |
| [xyz] | A collection of characters. Matches any one of the contained characters. For example,"[abc]can matchplainin thea"。 |
| [^xyz] | A set of characters with negative values. Matches any character not included. For example,"[^abc]can matchplainin thep"。 |
| [a-z] | A range of characters. Matches any character in the specified range. For example,"[a-z]can matchaTozAny lowercase alphabetic character within the range. |
| [^a-z] | Negative value character range. Matches any character that is not in the specified range. For example,"[^a-z]Can match any not inaTozAny character in the range. |
| \b | Match a word boundary, that is, the position between the word and the space. For example,"er\bcan matchneverin theerbut cannot matchverbin theer"。 |
| \B | Matches non-word boundaries."er\Bcan matchverbin theerbut cannot matchneverin theer"。 |
| \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, treat c as an original"ccharacter. |
| \d | Matches a numeric character. Equivalent to [0-9]. |
| \D | Matches a non-numeric character. Equivalent to [^ 0-9]. |
| \f | Matches a page break. Equivalent to \x0c and \cL. |
| \n | Matches a line break. Equivalent to \x0a and \cJ. |
| \r | Matches a carriage return character. Equivalent to \x0d and \cM. |
| \s | Matches any white space characters, including spaces, tabs, page breaks, and so on. Equivalent to [\f\n\r\t\v]. |
| \S | Matches any non-white space character. Equivalent to [^ \f\n\r\t\v]. |
| \t | Matches a tab. Equivalent to \x09 and \cI. |
| \v | Matches a vertical tab. Equivalent to \x0b and \cK. |
| \w | Matches any word character that includes an underscore. Equivalent to"[A-Za-z0-9_]"。 |
| \W | Matches any non-word character. Equivalent to"[^A-Za-z0-9_]"。 |
| \xn | 匹配n, in whichnis a hexadecimal escaped value. The hexadecimal escape value must be two digits long. For example,"\x41"匹配"A"。"\x041is equivalent\x04&1. ASCII encoding can be used in regular expressions.. |
| \num | 匹配num, in whichnumis a positive integer. A reference to the obtained match. For example,"(.)\1Matches two consecutive identical characters. |
| \n | Identifies an octal escape value or a backward reference. If \nAt least before.ngets the subexpression of, thennis a backward reference. Otherwise, ifnis an octal number (0-7), thennis an octal escaped value. |
| \nm | Identifies an octal escape value or a backward reference. If \nmAt least before.nmobtains a subexpression, thennmis a backward reference. If \nmAt least before.nget, thennFor a text with a footnotemThe backward reference. If the previous conditions are not met, ifnandmare octal digits (0-7), then \nmOctal escape values will be matchednm。 |
| \nml | Ifnis an octal number (0-3), andm and lare octal digits (0-7), match octal escape valuesnml。 |
| \un | 匹配n, in whichnis a Unicode character represented by four hexadecimal digits. For example,\u00A9 matches the copyright symbol (©). |
| Username | /^[a-z0-9_-]{3,16}$/ |
|---|---|
| 密码 | /^[a-z0-9_-]{6,18}$/ |
| 密码2 | (?=^.{8,}$)(?=.*\d)(?=.*\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\n).*$(Composed of numbers/uppercase letters/lowercase letters/punctuation marks, all four must have, more than 8 digits) |
| Hexadecimal value | /^#?([a-f0-9]{6}|[a-f0-9]{3})$/ |
| Email address | /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/ /^[a-z\d] (\.[a-z\d] )* @([\da-z](-[\da-z])?) (\.{1,2}[a-z]) $/or\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* |
| URL | /^(https ?:\/\/)?([\da-z\.-] )\.([a-z\.]{2,6})([\/\w \.-]*) \/?$/or[a-zA-z]+://[^\s]* |
| IP address | /((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)/ /^(?:(?:25[0-5]| 2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]| 2[0-4][0-9]|[01]?[0-9]?)$/or((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?) |
| HTML Tags | /^<([a-z] )([^<] )*(?:>(.*)<\/\1 >|\ s \/>)$/or<(.*)(.*)>.*<\/\1>|<(.*) \/> |
| Delete Code \\Comment | (?<!http:|\S)//.*$ |
| Match double-byte characters (including Chinese characters) | [^\x00-\xff] |
| Kanji (character) | [\u4e00-\u9fa5] |
| Range of Chinese Characters in Unicode Coding | /^[\u2E80-\u9FFF]+$/ |
| Chinese and full-length punctuation marks (characters) | [\u3000-\u301e\ufe10-\ufe19\ufe30-\ufe44\ufe50-\ufe6b\uff01-\uffee] |
| Date (Year-Month-Day) | (\d{4}|\d{2})-((0?([1-9]))|(1[1|2]))-((0?[1-9])|([12]([1-9]))|(3[0|1])) |
| Date (Month/Day/Year) | ((0?[1-9]{1})|(1[1|2]))/(0?[1-9]|([12][1-9])|(3[0|1]))/(\d{4}|\d{2}) |
| Time (hours: minutes, 24-hour system) | ((1|0?)[0-9]|2[0-3]):([0-5][0-9]) |
| Mainland China fixed telephone number | (\d{4}-|\d{3}-)?(\d{8}|\d{7}) |
| Mainland China mobile phone number | 1\d{10} |
| China Mainland Postal Code | [1-9]\d{5} |
| Mainland China ID number (15 or 18 digits) | \d{15}(\d\d[0-9xX])? |
| Non-negative integer (positive integer or zero) | \d+ |
| Positive integer | [0-9]*[1-9][0-9]* |
| negative integer | -[0-9]*[1-9][0-9]* |
| Integer | -?\d+ |
| Decimal. | (-?\d+)(\.\d+)? |
| Blank Row | \n\s *\r or \n\n(editplus) or ^[\s\S ]*\n |
| QQ number | [1-9]\d{4,} |
| Words that do not contain abc | \b((?!abc)\w)+\b |
| Match leading and trailing white space characters | ^\s*|\s*$ |
| Edit common | The following are some replacements for special Chinese (editplus) ^[0-9].*\n ^[^ th].*\n ^ [Exercise].*\n ^[\s\S ]*\n ^[0-9]*\. ^[\s\S ]*\n <p[^<>*]> href="javascript:if\(confirm\('(.*?)'\)\)window\.location='(.*?)'" <span style=".[^"]*rgb\(255,255,255\)">.[^<>]*</span> <DIV class=xs0>[\s\S]*?</DIV> |
Regular expression syntax for your commonly used regular expression quick look-up table, regular expression syntax query, commonly used regular expression syntax, regular expression basic syntax, sub-expression syntax, regular expression modifiers, regular expression greedy mode, regular expression non-greedy mode, through a simple and fast method to achieve the control of the string.
Friend Links:iCMS