正規文字 | describe |
---|---|
\ | 次の文字を特殊文字、または文字、またはバックリファレンス、または8進数エスケープ文字としてマークします。例えば、"N "一致文字「N "." n "改行文字を一致させます。シリアル"\\ "Match."\ "および" ( "Then match"( ". |
^ | 入力文字列の開始位置を一致させます。RegExpオブジェクトのMultilineプロパティが設定されている場合、^も一致します" n "Or" r "その後です。 |
$ | 入力文字列の終了位置を一致させます。$もしくは、RegExpオブジェクトのMultilineプロパティが設定されている場合、も一致します" n "Or" r "前の位置です。 |
* | 前のサブエクスプレッションが0回または複数回一致します。例えば、zo * 一致する場合もあります "Z "および"zoo ". * に等しいです {0,}. |
+ | 前のサブエクスプレッションが1回または複数回一致します。例えば、"zo+ "Can match"zo "および"zoo "But they don't match."Z ".+ に等しいです {1,}。 |
? | 前のサブエクスプレッションが0回または1回一致します。例えば、"do(es)? "Can match"does "Or"does "In"do ".? {0,}に相当します1}. |
{N} | N 非-負の整数です。一致が決定されました N回数。例えば、"o{2} "は一致しませんBob "In"o "が一致する場合もありますFood "two o" |
{N,} | N 非-負の整数です。少なくとも一致します N回数。例えば、"o{2,} "は一致しませんBob "In"o "が一致する場合もありますfoooood "すべてのo"O {1,} "同等の"O + "."O {0,} "Is equivalent to"O * ". |
{N,m} | mandNどちらも非-負の整数、N< =m最も少ないマッチN2回目および最も多くのマッチm回数。例えば、"O {1,3} "一致します"FOOOOD "の最初の3つのo"O {0,} 1} "同等の"O? "。ただし、カンマと2つの数字の間にはスペースがありません。" |
? | 文字が他の制限子(*,+,?、{N,}, {N,}, {N,m}) その後、一致するパターンは非-がんばり過ぎた-がんばり過ぎたパターンはできるだけ少ない文字列に一致し、デフォルトのがんばり過ぎたパターンはできるだけ多くの文字列に一致します。例えば、文字列「Oooo ",O +? "単一に一致します"o "そして"O + "すべてに一致します"o ". |
. | マッチを除く「\ N 任意の単一の文字で「.」を除く。含めるには「\ N "含まれる任意の文字、以下のようになります"(. | n) "モデル。 |
(パターン) | パターンに一致し、マッチを取得します。取得したマッチは、VBScriptのSubMatchesコレクションを使用して結果コレクションから取得できます、0ドル... 9 ドル属性のJScriptで一致させるには「 ( "Or") ". |
(?: パターン) | パターンに一致しますが、マッチ結果を取得しません、つまり、これは非-マッチを取得し、後で使用するために保存しません。これは「または」文字「(|) "パターンの一部を組み合わせるのは便利です。例えば"industr(?: y | ies) "ただの比較"業界 | 業界 "より短い表現" |
(? = パターン) | ポジティブなプレシーチは、一致するパターンの文字列の先頭に一致するルックアップ文字列をマッチングします。これは非-マッチを取得しています、つまり、後で使用するためにマッチを取得する必要はありません。例えば、"Windows (? = 95 | 98 | NT | 2000) "Can match"Windows 2000 "In"Windows "But they don't match."Windows 3.1 "In"Windows ". Pre-検索は文字を消費しません、つまり、マッチが発生した後、次のマッチの検索は最後のマッチの直後にすぐに開始されます。パターンの前-検索。 |
(?!パターン) | ネガティブなルックアップは、パターンに一致しない任意の文字列の先頭に一致するルックアップ文字列をマッチングします。これは非-fetch match, that is, the match does not need to be fetched for later use. For example "Windows (?! 95 | 98 | NT | 2000) "Can match"Windows 3.1 "In"Windows "But they don't match."Windows 2000 "In"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 "Can match"2000Windows "In"Windows "But they don't match."3.1 Windows "In"Windows ". |
(? <! pattern) | A reverse negative precheck is analogous to a forward negative precheck, but in the opposite direction. For example "(? <! 95 | 98 | NT | 2000) Windows "Can match"3.1 Windows "In"Windows "But they don't match."2000Windows "In"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 character contained. For example, "[Abc] "Can match"plain "In"A ". |
^[^ xyz] | Set of negative characters. Matches any character not contained. For example, "^[^ abc] "Can match"plain "In"p ". |
[A-z] | Character range. Matches any character within the specified range. For example, "[A-z] "Can match"A "To."Z "Any lowercase alphabetic character in the range. |
^[^ a-z] | Negative character range. Matches any character that is not within the specified range. For example, "^[^ a-z] "Can match anything that is not there"A "To."Z "Any character in the range. |
B | 単語の境界を一致させます、つまり単語とスペースの間の位置を指します。例えば、"Er b "Can match"Never "In"er "But they don't match."Verb "In"er ". |
B | 非-word boundaries. "Er B "Can match"Verb "In"er "But they don't match."Never "In"er ". |
Cx | xで指定された制御文字を一致させます。例えば、cMはControl-Mまたはカーソルリターン。xの値はA-Zまたはa-z. それ以外の場合、cを文字通りに扱います。C 文字。 |
D | 数値文字を一致させます。[0]に等しい。-9]. |
D | 非-数値文字。[^ 0]に等しい。-9]. |
F | ページフィード文字を一致させます。x0cおよびcLに等しい。 |
n | 改行文字を一致させます。x0aおよびcJに等しい。 |
r | カーソルリターンを一致させます。x0dおよびcMに等しい。 |
s | Matches any whitespace character, including spaces, tabs, page feeds, etc. Equivalent to [ f n r t v]. |
S | Matches any non-whitespace 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 including an underscore. Equivalent to "[A-Za-z0- 9_] ". |
W | Matches any non-word character. Equivalent to "[^ A-Za-z0- 9_] ". |
XN | matchN, in whichNEscape the value for hexadecimal. the hexadecimal escape value must be a determined two-digit length. For example, " X41 "Match."A "." X041 "Is equivalent to" X04 & 1 ". ASCII encoding can be used in regular expressions.. |
\Num | matchNum, in whichNumIs a positive integer. A reference to the match obtained. For example, "(.) 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-4d | 25 [0-5] | [01? d d?) .) {3}2 [0-4d | 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-4d | 25 [0-5] | [01? d d?) .) {3}2 [0-4d | 25 [0-5] | [01]? d d?) |
HTMLタグ | /^ < ([a - z ]+)([^<]+)*(?:>(.*)</ 1 > | s +/)>$/ または<(.*)(.*)>.*</ 1 >|<(.*) /> |
コード・コメントを削除 | (? <! http: | S)//. * $ |
重複を一致させる-バイト文字(中国文字を含む) | [^ x00- xff] |
漢字(文字) | [One -] |
Unicodeエンコーディングにおける中国文字の範囲 | /^ [-] + $/ |
中国および全角-幅の記号文字(文字) | [- -: -, -! - 🥰] |
日付(年-月-日) | ( d {4}) | d {2) - ((0? ([1-9)) | (1 [1 | 2)) - ((0? [1-9]) | ([12] ([1-9)) | (3 [0 | 1)) |
日付(月/日/年) | ((0? [1-9] {1}) | (1 [1 | 2))/(0? [1-9] | ([12] [1-9)) | (3 [0 | 1))/( d {4}) | d {2) |
時間(時:分、 24-時針 | ((1 | 0?) [0-9] | 2 [0-3])): ([0-5] [0-9]) |
中国本土固定電話番号 | ( d {4} - | d {3} -)? ( d {8}) | d {7) |
中国本土携帯電話番号 | 1 d {10} |
中国本土郵便番号 | [1-9] d {5} |
中国本土ID番号(15 または 18 桁) | D {15} ( d d [0-9xX])? |
非-負の整数(正の整数または0) | D + |
正の整数 | [0-9] * [1-9] [0-9] * |
負の整数 | - [0-9] * [1-9] [0-9] * |
整数 | -? d + |
小数 | (-? d +) (. d +)? |
空白行 | N s * rまたはn n(editplus)または^ [ s S] * n |
QQ番号 | [1-9] d {4,} |
abcを含まない単語 | B ((?! abc) w) + b |
最初および最後の空白文字を一致させる | ^ s * | s * $ |
エディタでよく使用されます | 特別な中国語(editplus)の一部の置換があります。 ^ [0-9]. * n ^ [^]. * 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 > |
一般的な正規表現のチェックリスト用の正規表現文法、正規表現文法クエリ、一般的な正規表現文法、正規表現の基本的な文法、サブ-式文法、正規表現修飾子、正規表現貪欲モード、正規表現非-貪欲モード、単純で速い方法で文字列を制御する。