Regular characters Description
\ Marks the next character as a special character, or a literal character, or a backreference, or an octal escape. For example, “ n"Match character" n"." \n"Match a newline. Serial" \\"match" \"while" \(" then match" (".
^ matches the beginning of the input string. If the Multiline property of the RegExp object is set, ^ also matches “ \n" or " \r".
$ matches the end of the input string. If the Multiline property of the RegExp object is set, $ also matches “ \n" or " Position before \r".
* matches the preceding subexpression zero or more times. For example, zo* matches “ z" and " zoo".*Equivalent to {0,}.
+ matches the preceding subexpression one or more times. For example, “ zo+"can match" zo" and " zoo", but cannot match " z". + is equivalent to {1,}.
? matches zero or one occurrence of the preceding subexpression. For example, “ do(es)?"can match" does"or" does"in" do".? Equivalent to {0,1}.
{ n} n is a non-negative integer. match determined n times. For example, “ o{2}"cannot match" Bob in " o", but can match " The two o's in food".
{ n,} n is a non-negative integer. match at least n times. For example, “ o{2,}"cannot match" Bob in " o", but matches " All o's in foooood" o{1,}"is equivalent to" o+"." o{0,}" is equivalent to " o*".
{ n, m} m and n are all non-negative integers, where n<= m. least match n matches at most m times. For example,“ o{1,3}" will match" The first three o's in fooooood"." o{0,1}"is equivalent to" o?". Note that there is no space between the comma and the two numbers.
? When this character is immediately followed by any other limiter (*,+,?,{ n}, { n,},{ n, m}), the matching pattern is non-greedy. The non-greedy mode matches the search string as little as possible, while the default greedy mode matches the search string as much as possible. For example, for the string “ oooo", " o+?" will match a single " o", while " o+" will match all" o".
. matches except “ \ n " any single character. To match include " \ n ", use a character like " (.|\n)" pattern.
(pattern) matches pattern and retrieves this match. The acquired matches can be obtained from the generated Matches collection, using the SubMatches collection in VBScript, and using the $0...$9 property in JScript. To match parenthesis characters, use “ \("or" \)".
(?:pattern) matches pattern but does not get the matching result, which means it is a non-getting match and is not stored for later use. This is done using the or character “ (|)" is useful to combine parts of a pattern. For example" industr(?:y|ies)"is a ratio" industry|industries" is a shorter expression.
(?=pattern) Positive lookahead, matches the search string at the beginning of any string matching pattern. This is a non-acquiring match, that is, the match does not need to be acquired for later use. For example, “ Windows(?=95|98|NT|2000)"can match" Windows2000in" Windows", but cannot match " Windows3.1" in " Windows". Lookahead does not consume characters, that is, after a match occurs, the search for the next match begins immediately after the last match, rather than after the character containing the lookahead.
(?!pattern) Negative lookahead, matches the search string at the beginning of any string that does not match pattern. This is a non-acquiring match, that is, the match does not need to be acquired for later use. For example “ Windows(?!95|98|NT|2000)"can match" Windows3.1" in " Windows", but cannot match " Windows2000in" Windows". Lookahead does not consume characters, that is, after a match occurs, the search for the next match begins immediately after the last match, not after the character containing the lookahead
(?<=pattern) Reverse positive pre-check is similar to positive positive pre-check, but in the opposite direction. For example, “ (?<=95|98|NT|2000)Windows"can match" 2000Windowsin" Windows", but cannot match " in 3.1Windows" Windows".
(?<!pattern) Reverse negative preview is similar to positive negative preview, but in the opposite direction. For example “ (?<!95|98|NT|2000)Windows"can match" in 3.1Windows" Windows", but cannot match " 2000Windowsin" Windows".
x|y matches x or y. For example, “ z|food"can match" z" or " food"." (z|f)ood" then match" zood" or " food".
[xyz] character set. Matches any one of the contained characters. For example, “ [abc]"can match" plain" in " a".
[^xyz] Negative character set. Matches any character not contained. For example, “ [^abc]"can match" plain" in " p".
[a-z] character range. Matches any character in the specified range. For example, “ [a-z]"can match" a"to" Any lowercase alphabetic character in the range z".
[^a-z] Negative character range. Matches any arbitrary character not in the specified range. For example, “ [^a-z]"can match any not in" a"to" Any character within the range z".
\b matches a word boundary, that is, the position between a word and a space. For example, “ er\b"can match" never" in " er", but cannot match " verb" in " er".
\B matches non-word boundaries. “ er\B"can match" verb" in " er", but cannot match " never" in " er".
\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 a literal “ c" character.
\d matches a single digit character. Equivalent to [0-9].
\D matches a non-digit character. Equivalent to [^0-9].
\f matches a form break. Equivalent to \x0c and \cL.
\n matches a newline character. Equivalent to \x0a and \cJ.
\r matches a carriage return. Equivalent to \x0d and \cM.
\s matches any whitespace character, including spaces, tabs, form feeds, and so on. Equivalent to [ \f\n\r\t\v].
\S matches any non-whitespace character. Equivalent to [^ \f\n\r\t\v].
\t matches a tab character. Equivalent to \x09 and \cI.
\v matches a vertical tab character. Equivalent to \x0b and \cK.
\w matches any word character including an underscore. Equivalent to “ [A-Za-z0-9_]".
\W matches any non-word character. Equivalent to “ [^A-Za-z0-9_]".
\x n matches n, where n is the hexadecimal escape value. Hex escape values must be a certain two digits long. For example, “ \x41"match" A"." \x041" is equivalent to " \x04&1". ASCII encoding can be used in regular expressions.
\ num 匹配 num,其中 num是一个正整数。对所获取的匹配的引用。例如,“ (.)\1"匹配两个连续的相同字符。
\ n identifies an octal escape value or a backreference. if\ n before at least n acquired subexpressions, then n is a back reference. Otherwise, if n is an octal number (0-7), then n is an octal escape value.
\ nm identifies an octal escape value or a backreference. if\ nm before at least nm get subexpressions, then nm is a back reference. if\ nm before at least n fetches, then n is a followed text Backreferences for m. If none of the preceding conditions are met, if n and m are all octal numbers (0-7), then\ nm will match octal escaped values nm.
\ nml if n is an octal number (0-3), and m and l are both octal numbers (0-7), then match the octal escape value nml.
\u n matches n, where n is a Unicode character represented by four hexadecimal digits. For example, \u00A9 matches the copyright symbol(©)。
Username /^[a-z0-9_-]{3,16}$/
Password /^[a-z0-9_-]{6,18}$/
Password 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)
hex value /^#?([a-f0-9]{6}|[a-f0-9]{3})$/
Email /^([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][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]
Chinese characters (characters) [\u4e00-\u9fa5]
The scope of Chinese characters in Unicode encoding /^[\u2E80-\u9FFF]+$/
Chinese and full-width 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 (MM/DD/YYYY) ((0?[1-9]{1})|(1[1|2]))/(0?[1-9]|([12][1-9])|(3[0|1]))/(\d{4}|\d{2})
Time (hour:minute, 24-hour format) ((1|0?)[0-9]|2[0-3]):([0-5][0-9])
Fixed phone numbers in Mainland China (\d{4}-|\d{3}-)?(\d{8}|\d{7})
Mainland China Mobile Number 1\d{10}
Mainland China postal code [1-9]\d{5}
Chinese mainland 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+
Decimals (-?\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 blank characters ^\s*|\s*$
Editor's Common
The following are some replacements for special Chinese (editplus)
^[0-9].*\n
^[^第].*\n
^[习题].*\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

Regular expression grammar is your common regular expression cheat sheet, regular expression grammar query, common regular expression grammar, regular expression basic grammar, subexpression grammar, regular expression modifier, regular expression greedy Mode, the regular expression non-greedy mode, achieves the control of strings through a simple and fast method.

Your Footsteps:

Popular tools: