объяснитерегулярное выражение
Website (URL)[a-зА-z]+:://[^ s]*
IP адрес((2[0-4]\d|25[0-5] | [01]?\d\d?)\.){3}(2[0-4]\d|25[0-5] | [01]?\d\d?)
Email address\w+([-+.] w+)*@ w+([-.] w+)*. ш+([-.] w+)*
QQ number[1-9] d {4,}
HTML markup (including content or self-closing)<(.*)(.*)>.*<\/\1>|<(.*) \/>
Password (consists of numbers/uppercase letters/lowercase letters/punctuation marks, all four must be available, more than 8 цифры)(?=^.{8,}$)(?=.*\d)(?=.*\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\n).*$
Date (year-month-day)( д {4} | d {2})-((1[0-2])|(0?[1-9]))-(([12] [0-9])|(3[01])|(0?[1-9]))
Date (Month/Day/Year)((1[0-2])|(0?[1-9]))/(([12] [0-9])|(3[01])|(0?[1-9]))/( д {4} | d {2})
Time (hour: minutes, 24-hour clock)((1|0?)[0-9] |2[0-3]): ([0-5] [0-9])
Китайский (иероглиф)[ u4е00- ты9фа5]
китайский и полный-ширина знаков препинания (знаков)[ u3000- ты301е уфе10- уфе19 уфе30- уфе44 уфе50- уфе6б уфф01- uffee]
Фиксированный телефонный номер материковой части Китая( д {4}-| d {3}-)? ( d {8} | d {7})
Номер мобильного телефона материковой части Китая1 д {10}
Почтовый индекс материковой части Китая[1-9] d {5}
Идентификационный номер материкового Китая (15 или 18 цифры) д {15} ( d d [0-9xX])?
Нет-отрицательное целое число (положительное целое или ноль)\d+
положительное целое[0-9]*[1-9] [0-9]*
отрицательное целое-[0-9]*[1-9] [0-9]*
целое-? д+
десятичное(-? д+) (. д+)?
Слова, которые не содержат abc b ((?! abc) w)+\b
объяснитерегулярное выражение
имя пользователя/^[a-z0-9_-] {3,16} $/
пароль/^[a-z0-9_-] {6,18} $/
шестнадцатеричное значение/^ #? ([а-ф0-9] {6} | [а-ф0-9] {3}) $/
Е-почтовый адрес/^ ([а-z0-9_.-]+) @ ([ da-z.-]+). ([a-z.] {2,6}) $/
URL/^ (https?:\/\/)? ([ da-z.-]+). ([a-z.] {2,6}) ([\/ ж.-]*)*\/? $/
IP адрес/^ (?: (?: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]?) $/
HTML тег/^ < ([а-z]+) ([^ <]+)*(?: > (.*) <\/\1> | с+\/>) $/
Диапазон китайских символов в кодировке Unicode/^ [ты4е00-ты9фа5], {0,} $/
Регулярные выражения, соответствующие китайским иероглифам[ u4е00- ты9фа5]
Комментарий: Подходящий китайский - это действительно головная боль. С эт****ыражением легко справиться
Матч дубль-Байтовые символы (включая китайские иероглифы)[^ x00- xff]
Комментарий: Может использоваться для вычисления длины строки (2 на дубль-байтовый символ, 1 для ASCII символов)
Регулярное выражение, совпадающее с пустыми строками н с*\r
Примечания: Может использоваться для удаления пустых строк
Регулярные выражения, которые соответствуют тегам HTML< ( S*?) [^ >]*>.*? </\1> | <.*?/>
Комментарий: Версия, распространяемая в Интернете, очень плоха. Вышеуказанная версия может соответствовать только ее части, и она по-прежнему бессильна для сложных вложенных тегов.
Регулярное выражение, совпадающее с первым и последним пробельными символами^ с*| с*$
Комментарий: Может использоваться для удаления пробельных символов в начале и конце строки (включая пробелы, вкладки, разрывы страниц и т. д.), очень полезное выражение.
Регулярное выражение для сопоставления адресов электронной почты\w+([-+.] w+)*@ w+([-.] w+)*. ш+([-.] w+)*
Примечания: Полезно для проверки формы
Регулярное выражение Соответствие URL[a-зА-z]+:://[^ s]*
Комментарий: Версия, распространяемая в Интернете, имеет очень ограниченные функции, и вышеуказанная может в основном удовлетворить потребности.
Сопоставьте, является ли учетная запись законной (начните с письма, разрешите 5-16 байт, разрешить буквенно-цифровые подчеркивания)^[a-зА-З] [а-зА-Z0-9_] {4,15} $
Примечания: Полезно для проверки формы
Совпадение внутренних телефонных номеров д {3}- д {8} | d {4}- д {7}
Комментарий: Соответствующие формы, такие как 0511-4405222 или 021-87888822
Матч Tencent QQ номер[1-9] [0-9] {4,}
Комментарий: номер Tencent QQ начинается с 10000
Почтовый индекс материкового Китая[1-9] d {5} (?! d)
Комментарий: Почтовый индекс материкового Китая 6 цифры
Идентификатор соответствия д {15} | d {18}
Примечание: ID-карта материкового Китая 15 или 18 цифры
Совпадение IP адресов\d+\.\d+\.\d+\.\d+
Примечания: Полезно при извлечении IP-адресов
Соответствовать конкретным номерам:
^ [1-9]\d*$//совпадать с положительным целым числом
^-[1-9]\d*$//совпадать с отрицательным целым числом
^-? [1-9]\d*$//совпадение целое
^ [1-9]\d*|0$Match non-отрицательные целые числа (положительные целые числа + 0)
^-[1-9]\d*|0$Match non-положительные целые (отрицательные целые + 0)
^ [1-9]\d*\.\d*|0\.\d*[1-9]\d*$//Матч положительный плавающий-point numbers
^-([1-9]\d*\.\d*|0\.\d*[1-9]\d*) $//матч отрицательный плавающий-point numbers
^-? ([1-9]\d*\.\d*|0\.\d*[1-9]\d*| 0? .0+| 0) $//матч плавающий-point numbers
^ [1-9]\d*\.\d*|0\.\d*[1-9]\d*| 0? .0+|0$Match non-отрицательный плавающий-point numbers (positive floating-point numbers + 0)
^(-([1-9]\d*\.\d*|0\.\d*[1-9]\d*))|0?\.0+|0$Match non-positive floating-point numbers (negative floating-point numbers + 0)
Notes: Useful when dealing with large amounts of data, pay attention to corrections in specific applications.
Match specific strings
^[A-Za-z]+$//Match a string of 26 English letters
^[A-Z]+$//Matches a string of 26 English letters
^[a-z]+$//Matches a string of 26 lowercase letters
^[A-Za-z0-9]+$//Match a string of numbers and 26 letters
^\w+$//Matches a string consisting of numbers, 26 letters, or underscores
characterdescribe
\Marks the next character as a special character, or a literal character, or a backward reference, or an octal escape character. For example, "n" matches the character "n". " n" matches a newline character. The sequence "\" matches "" and " (" matches " (").
^Matches the starting position of the input string. If the Multiline property of the RegExp object is set, ^ also matches the position after " n" or " r".
$Matches the end position of the input string. If the RegExp object's Multiline property is set, $ also matches the position before "\n" or "\r".
*Matches the preceding subexpression zero or more times. For example, zo * can match "z" and "zoo". * is equivalent to {0,}.
+Matches the preceding subexpression one or more times. For example, "zo +" matches "zo" and "zoo", but not "z". + is equivalent to {1,}.
?Matches the preceding subexpression zero or once. For example, "do (es)?" can match "do" in "do" or "does".? is equivalent to {0,1}.
{n}n is a non-negative integer. Matches certain n times. For example, "o {2}" does not match the "o" in "Bob", but it does match two o's in "food".
{n,}n is a non-negative integer. Matches at least n times. For example, "o {2,}" does not match "o" in "Bob", but does match all o in "foooood". "o {1,}" is equivalent to "o +". "o {0,}" is equivalent to "o *".
{n,m}m and n are both non-negative integers, where n < = m. Match at least n times and 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 can be no spaces between commas and two numbers.
?When the character immediately follows any other constraint(*,+,?,{n},{n,},{n,m}),the matching pattern is non greedy. The non greedy mode matches the searched string as little as possible, while the default greedy mode matches the searched string as much as possible.For example, for string "oooo", "o +?" will match a single "o", and "o +" will match all "o".
.Matches any single character except " n". To match any character including " n", use a pattern like "[.n]".
(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 a pattern but does not obtain a match result, that is, it is a non-fetching match and is not stored for later use. This is useful when using the or character " (|) " to combine parts of a pattern. For example, "industr (?: y | ies) " is a shorter expression than "industry | industries".
(?=pattern)Forward lookup matches the lookup string at the beginning of any string that matches 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) " matches "Windows" in "Windows2000", but not "Windows" in "Windows3.1". A lookup does not consume characters, that is, after a match occurs, the search for the next match starts immediately after the last match, rather than after the character containing the lookup.
(?!pattern)Negative lookup 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) " matches "Windows" in "Windows3.1", but not "Windows" in "Windows2000". A lookup does not consume characters, that is, after a match occurs, the search for the next match starts immediately after the last match, rather than after the character containing the lookup.
x|yMatches x or y. For example, "z | food" matches "z" or "food". " (z | f) ood" matches "zood" or "food".
[xyz]Character set. Matches any character contained. For example, "[abc]" matches "a" in "plain".
[^xyz]Set of negative characters. Matches any character not contained. For example, "[^ abc]" matches "p" in "plain".
[a-z]Character range. Matches any character in the specified range. For example, "[a-z]" can match any lowercase character in the range "a" to "z".
[^a-z]Negative character range. Matches any character not in the specified range. For example, "[^ a-z]" can match any character not in the range "a" to "z".
\bMatches a word boundary, which refers to the position between the word and the space. For example, "er b" can match "er" in "never", but not "er" in "verb".
\BMatches non-word boundaries. "er B" matches "er" in "verb", but not "er" in "never".
\cxMatches the control character specified by x. For example, cM matches a Control-M or carriage return. The value of x must be either A-Z or a-z. Otherwise, c is treated as a literal "c" character.
\dMatches a numeric character. Equivalent to [0-9].
\DMatches a non-numeric character. Equivalent to [^ 0-9].
\fMatches a page feed character. Equivalent to \x0c and \cL.
\nMatches a newline character. Equivalent to \x0a and \cJ.
\rMatches a carriage return. Equivalent to \x0d and \cM.
\sMatches any whitespace character, including spaces, tabs, page feeds, etc. Equivalent to [\f\n\r\t\v].
\SMatches any non-whitespace character. Equivalent to [^\f\n\r\t\v].
\tMatches a tab. Equivalent to \x09 and \cI.
\vMatches a vertical tab. Equivalent to \x0b and \cK.
\wMatches any word character that includes an underscore. Equivalent to "[A-Za-z0-9_]".
\WMatches any non-word character. Equivalent to "[^ A-Za-z0-9_]".
\xnMatches n, where n is the hexadecimal escape value. The hexadecimal escape value must be the length of the identified two numbers. For example, " \x41" matches "A". " \x041" is equivalent to " \x04 & 1". ASCII encoding can be used in regular expressions..
\numMatches num, where num is a positive integer. A reference to the match obtained. For example, " (.) 1" matches two consecutive identical characters.
\nIdentifies an octal escaped value or a backwards reference. If \n is preceded by at least n acquired subexpressions, then n is a backwards reference. Otherwise, if n is an octal number (0-7), then n is an octal escaped value.
\nmIdentifies an octal escape value or a backwards reference. Nm is a backwards reference if nm is preceded by at least nm acquirer expressions. If \nm is preceded by at least n acquirers, then n is a backwards reference followed by the literal m. If neither of the preceding conditions is met, if both n and m are octal digits (0-7), то нм будет соответствовать восьмеричному экранирующему значению нм.
нмлЕсли n восьмеричная цифра (0-3), а m и l восьмеричные числа (0-7), восьмеричное экранирующее значение nml соответствует.
unСопоставьте n, где n - символ Юникода, представленный четырьмя шестнадцатеричными цифрами. Например, u00A9 Соответствует символу авторского права (©).
Ваши шаги: