跳轉到主要內容
名稱慣用表示法使用範例
任意字元*"c"*"t" – 可符合 cat、cot 等字詞。
字母CC"ot" – 可符合 Rot、pot、cot、Dot、mot 等字詞。
大寫字母AA"ot" – 可符合 Rot、Cot、Mot、Dot 等字詞。
小寫字母aa"ot" – 可符合 rot、cot、mot、dot 等字詞。
字母或數字XX – 可符合任何單獨的數字或字母。
數字NN"th" 可符合 5th、4th、6th 等字詞。
字串" ""cot"
```“pl”(“o""a”)“t”` – 可符合 “plot” 和 “plat” 這兩個字詞。
群組中的字元[][tm]"ot" – 可符合 “tot” 和 “mot” 這兩個字詞。
不在群組中的字元[^][^t]"ot" – 可符合 “cot”、“lot” 等字詞,但不符合 “tot” 這個字詞。
空格 (在群組內)\s[A\s] 只可符合字母 A 或空格。
任意次數的重複 (套用至左側的表達式或子表達式){-}[AB74]{-} – 可符合由字元 A、B、7、4 組成的任意長度組合。
重複 n 次{n}N{2}"th" 可符合 25th、84th、11th 等字詞。
重複 n 到 m 次{n-m}N{1-3}"th" 可符合 5th、84th、111th 等字詞。
重複 0 到 n 次{-n}N{-2}"th" 可符合 84th、5th 等字詞。
重複 n 次以上{n-}N{2-}"th" 可符合 25th、834th、311th、34576th 等字詞。
子表達式()
連字號符號[\-]
反斜線符號[\\]

正則表達式示例

  1. 郵政編碼:[0-9]{6} 範例值:“142172”
  2. ZIP 郵遞區號 (USA) :[0-9]{5}("-"[0-9]{4}){-1} 範例值:“55416”、“33701-4313”
  3. 收入:N{4-8}[,]N{2} 範例值:“15000,00”、“4499,00”
  4. 月份的數字形式:((|"0")[1-9])|("10")|("11")|("12") 範例值:“4”、“05”、“12”
  5. 分數:("-"|)([0-9]{1-})(|((".",")([0-9]{1-}))) 範例值:“1234,567”、“0.99”、“100,0”、“-345.6788903”
  6. 電子郵件:[A-Za-z0-9_]{1-}((".""-")[A-Za-z0-9_]{1-}){-3}"@"[A-Za-z0-9_]{1-}((".""-")[A-Za-z0-9_]{1-}){-4}"."([A-Za-z]{2-4}|"asia"|"museum"|"travel"|"example"|"localhost") 範例值:“support@abbyy.com”、“my-name@company.org.ru”、“info@gallery.museum