跳转到主要内容
名称约定表示法使用示例
任意字符*"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. 美国邮编(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