regular character | describe |
---|---|
\ | Marks the next character as a special character, or a literal character, or a backward reference, or an octal escape character. For example, “N " match character "N "." н " Matches a newline character. Serial "\ "Матч".\ " and " ( "Then match"( ". |
^ | Matches the starting position of the input string. If the Multiline property of the RegExp object is set, ^ also matches “ н "Or" р " after that. |
$ | Matches the end position of the input string. $also matches if the Multiline property of the RegExp object is set “ н "Or" р " previous location. |
* | Matches the preceding subexpression zero or more times. For example, zo * can match “Z " and "zoo ". * Equivalent to {0,}. |
+ | Matches the preceding subexpression one or more times. For example,“zo+ "Может сравниться"zo " and "zoo "Но они не совпадают".Z ".+ is equivalent to {1,}. |
? | Matches the preceding subexpression zero or once. For example,“do(es)? "Может сравниться"does "Or"does "В"do ".? Equivalent to {0,1}. |
{N} | N Is a non-negative integer. Match determined NTimes. For example, "o{2} " Can't match "Bob "В"o ", but can match "Food "two o. |
{N,} | N Is a non-negative integer. Matches at least NTimes. For example, "o{2,} " can't match "Bob "В"o ", but can match "foooood " all o."O {1,} "Equivalent to"O + "."O {0,} "Это эквивалентно"O * ". |
{N,m} | mandNBoth are non-negative integers, whereN< =mLeast matchNsecond and most matchesmTimes. For example, "O {1,3} "Will match"FOOOOD "The first three o's in."O {0, 1} "Equivalent to"O? ". Please note that there can be no spaces between commas and two numbers." |
? | When the character immediately follows any other restrictor (*,+,?,{N}, {N,}, {N,m}) Later, the matching pattern is non-greedy. The non-greedy pattern matches as few strings as possible, while the default greedy pattern matches as many strings as possible. For example, for string "Oooo ","O +? "Will match a single"o "And"O + "Will match all"o ". |
. | Match except "\ N Any single character other than ". To match include"\ N "Any character included, please use something like"(. | n) "The model. |
(Pattern) | Matches the pattern and gets the match. The obtained match can be obtained from the resulting Matches collection, using the SubMatches collection in VBScript and the 0 dollars... 9 dollars attribute in JScript. To match parenthesis characters, use " ( "Or") ". |
(?: pattern) | Matches the pattern but does not fetch the match result, that is, it is a non-fetch match and is not stored for later use. This is used in the or character "(|) "It is useful to combine parts of a pattern. For example"industr (?: y | ies) "Just a comparison"Industries | industries "A more abbreviated expression." |
(? = pattern) | Positive presearch matches the lookup string at the beginning of the string of any matching 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) "Может сравниться"Windows 2000 "В"Windows "Но они не совпадают".Windows 3.1 "В"Windows ". Pre-search 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 pre-search." |
(?! pattern) | Forward negative lookup, which matches the lookup string at the beginning of any string that does not match the pattern. This is a non-fetch match, that is, the match does not need to be fetched for later use. For example "Windows (?! 95 | 98 | NT | 2000) "Может сравниться"Windows 3.1 "В"Windows "Но они не совпадают".Windows 2000 "В"Windows ". Pre-search 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 containing the pre-search |
(? < = pattern) | A reverse positive precheck is analogous to a forward positive precheck, but in the opposite direction. For example, "(? < = 95 | 98 | NT | 2000) Windows "Может сравниться"2000Windows "В"Windows "Но они не совпадают".3.1 Windows "В"Windows ". |
(? | A reverse negative precheck is analogous to a forward negative precheck, but in the opposite direction. For example "(? "Может сравниться" |
X | y | Matches x or y. For example, "Z | food "Может сравниться"Z "Or"Food "."(Z | f) ood "Then match"Zood "Or"Food ". |
[Xyz] | Character set. Matches any character contained. For example, "[Abc] "Может сравниться"plain "В"А ". |
[^ xyz] | Set of negative characters. Matches any character not contained. For example, "[^ abc] "Может сравниться"plain "В"p ". |
[A-z] | Character range. Matches any character within the specified range. For example, "[A-z] "Может сравниться"А "К".Z "Any lowercase alphabetic character in the range. |
[^ а-z] | Negative character range. Matches any character that is not within the specified range. For example, "[^ а-z] "Может сравниться со всем, чего нет"А "К".Z "Любой персонаж в диапазоне. |
Б | Соответствует границе слов, которая относится к положению между словом и пространством. Например, "Эр б "Может сравниться"Никогда "В"э "Но они не совпадают".Глагол "В"э ". |
Б | Матчи нет-Границы слов ".Эр Б "Может сравниться"Глагол "В"э "Но они не совпадают".Никогда "В"э ". |
Сх | Соответствует управляющему символу, указанному x. Например, cM соответствует Control-M или возврат каретки. Значение x должно быть одним из A-Z или a-з. В противном случае рассматривайте c как литерал "C "Характер. |
D | Соответствует числовому символу. Эквивалентно [0-9]. |
D | Совпадает с не-числовой символ. Эквивалент [^ 0-9]. |
F | Соответствует символу подачи страницы. Эквивалентно x0c и cL. |
н | Соответствует символу новой строки. Эквивалентно x0a и cJ. |
р | Соответствует возврату каретки. Эквивалентно x0d и cM. |
с | Соответствует любому символу пробела, включая пробелы, табуляции, каналы страниц и т. д. Эквивалент [f n r t v]. |
С | Соответствует любому не-пробельный символ. Эквивалентно [^ f n r t v]. |
т | Соответствует вкладке. Эквивалент x09 и СИ. |
V | Соответствует вертикальной вкладке. Эквивалентно x0b и cK. |
W | Соответствует любому символу слова, включая знак подчеркивания. Эквивалентно "[A-За-z0- 9_] ". |
W | Соответствует любому не-символ слова. Эквивалент "[^ А-За-z0- 9_] ". |
ИксN | matchN, in whichNПобег значение для hexadecimal. шестнадцатеричное значение побега должно быть определено два-длина цифры. Например, " Икс41 "Матч".А "." Х041 "Это эквивалентно" Х04 & 1 Кодировка ASCII может использоваться в регулярных выражениях. |
\Числ | matchЧисл, in whichЧислЯвляется положительным целым числом. Ссылка на полученное совпадение. Например, "(.) 1 "Matches two consecutive identical characters." |
\N | Identifies an octal escaped value or a backward reference. If\NBefore at leastNAn acquired subexpression, thenNFor backwards reference. Otherwise, ifNIs an octal number (0-7), thenNIs an octal escape value. |
\nm | Identifies an octal escaped value or a backward reference. If\nmAt least beforenmTo obtain a subexpression, thennmIs a backward reference. If\nmAt least beforeNAcquire, thenNFor a follow textmIf none of the previous conditions are satisfied, ifNandmBoth are octal digits (0-7), then\nmWill match octal escape valuesnm. |
\nml | IFNIs an octal number (0-3), andM and lBoth are octal digits (0-7), then match the octal escape valuenmL. |
uN | matchN, in whichNIs a Unicode character represented by four hexadecimal digits. For example, © matches the copyright symbol (©). |
user name | /^ [a - z0 - 9_ -] {3,16} $/ |
---|---|
password | /^ [a - z0 - 9_ -] {6,18} $/ |
Password 2 | (? = ^. {8 ,}$)(?=.* d )(?=.* W +)(?=.*[ A - Z ])(?=.*[ a - z ])(?!.* n). * $ (Consists of numbers/uppercase letters/lowercase letters/punctuation marks, all four must be available, more than 8 цифры) |
hexadecimal value | /^ #? ([a-f0-9] {6} | [a-f0-9] {3}) $/ |
E-mail address | /^ ([a - z0 - 9 _.-]+)@([ da - z .-]+).([ a - z.] {2,6}) $/ /^ [a-z d] + (. [a-z d ]+)*@([ d a-z] (- [ d a-z ])?)+(.{ 1,2} [a-z] +) + $/илиW +([-+.] w +) * @ w +([-.] w +) *. w +([-.] w +) * |
URL | /^ (https ?://)?([ da - z .-]+).([ a - z.] {2,6 })([/ w .-]*)*/?$/ или [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]?) $/или ((2 [0-4] d | 25 [0-5] | [01]? d d?) .) {3} (2 [0-4] d | 25 [0-5] | [01]? d d?) |
HTML tag | /^ < ([a - z ]+)([^<]+)*(?:>(.*) 1 > | s +/>)$/ или<(.*)(.*)>.*</ 1 >|<(.*) /> |
Remove Code\ Comments | (? |
Матч дубль-Байтовые символы (включая китайские иероглифы) | [^ x00- xff] |
Персонаж Kanji | [Один -] |
Диапазон китайских символов в кодировке Unicode | /^ [-] + $/ |
китайский и полный-ширина знаков препинания (знаков) | [- -:: -, -! - 🥰] |
Дата (год-месяц-день) | (д {4} | д {2}) - ((0? ([1-9]) | (1 [1 | 2])) - ((0? [1-9]) | ([12] ([1-9]) | (3 [0 | 1])) |
Дата (месяц/Day/год) | ((0? [1-9] {1}) | (1 [1 | 2]))/(0? [1-9] | ([12] [1-9]) | (3 [0 | 1]))/(д {4} | д {2}) |
Время (час: минуты, 24-Часовые часы) | ((1 | 0?) [0-9] | 2 [0-3]): ([0-5] [0-9]) |
Фиксированный телефонный номер материковой части Китая | (д {4} - | д {3} -)? (д {8} | д {7}) |
Номер мобильного телефона материковой части Китая | 1 д {10} |
Почтовый индекс материковой части Китая | [1-9] д {5} |
Идентификационный номер материкового Китая (15 или 18 цифры) | Д {15} (d d [0-9xX])? |
Нет-отрицательное целое число (положительное целое или ноль) | D + |
положительное целое | [0-9] * [1-9] [0-9] * |
отрицательное целое | - [0-9] * [1-9] [0-9] * |
целое | -? д + |
десятичное | (-? д +) (d +)? |
пустая строка | Н с * r или n (editplus) или ^ [s S] * н |
QQ номер | [1-9] д {4,} |
Слова, которые не содержат abc | B ((?! abc) w) + б |
Сопоставьте первый и последний пробельные символы | ^ с * | с * $ |
обычно используется редакторами | Вот некоторые замены для специальных китайских (editplus) ^ [0-9]. * н ^ [^]. * н ^ [Упражнение]. * н ^ [с] * н ^ [0-9] *. ^ [с] * н < p [^ < >*] > Href = "javascript: if (confirm ('(.*?) ') окно .location =' (.*?) '" < Span стиль =. "[^"]* РГБ (255, 255, 255 ) ">. [^ < >]*</ пролет > < класс DIV = xs0 > [s S] *? </ДИВ > |
Синтаксис регулярных выражений для общего контрольного списка регулярных выражений, запрос синтаксиса регулярных выражений, синтаксис общих регулярных выражений, базовый синтаксис регулярных выражений, sub-синтаксис выражения, модификатор регулярного выражения, жадный режим регулярного выражения, регулярное выражение non-жадный режим, через простой и быстрый способ управления строкой.