跳轉到主要內容
名稱慣用記號使用範例
任意字元*"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