Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 用于EXTJS中家庭/房屋地址验证的正则表达式_Regex_Regex Negation_Regex Lookarounds_Regex Greedy - Fatal编程技术网

Regex 用于EXTJS中家庭/房屋地址验证的正则表达式

Regex 用于EXTJS中家庭/房屋地址验证的正则表达式,regex,regex-negation,regex-lookarounds,regex-greedy,Regex,Regex Negation,Regex Lookarounds,Regex Greedy,我尝试了下面的正则表达式来验证住址 请给出你的建议 ^[a-zA-Z0-9#][-:,#. /A-Za-z0-9][a-zA-z]$ ^\d*[a-zA-Z#, .:-]+[a-zA-z0-9, #.:]* Example Address: #43, JohnStreet, Sidney, AUS 条件: 1.Door number must be 1-4 digits(ex: 1, 12, 56, 568, 5698, #12, #123, #1235) It should

我尝试了下面的正则表达式来验证住址
请给出你的建议

 ^[a-zA-Z0-9#][-:,#. /A-Za-z0-9][a-zA-z]$
^\d*[a-zA-Z#, .:-]+[a-zA-z0-9, #.:]*

 Example Address:
 #43,
 JohnStreet,
 Sidney,
 AUS
条件:

1.Door number must be 1-4 digits(ex: 1, 12, 56, 568, 5698, #12, #123, #1235)
 It should notbe like 123456, 132adfs
2.It should be like 
 809,
 Bangloore,
 Karnataka,
 India
3.We should't allow only numerics in complete address
^#?\d+,\r?\n[a-zA-Z#,.:-]+,\r?\n[a-zA-Z#,.:-]+,\r?\n[a-zA-Z#,.:-]+$

  • ^
    字符串的开头
  • #?
    哈希(又称磅)字符。问号使它成为可选的
  • (?:[1-9]\d{0,3})
    介于1和9之间的单个字符。然后是0到9之间的0到3位数字
以上匹配
#1
70
999
9018
,但不匹配
09
88880
-9981


  • ,\r?\n
    行尾:逗号、可选的“回车”字符(有时在读取文件时,服务器端会看到),然后是“换行符”
  • [a-zA-Z#,.:-]+
    字符集中的任何合法字符(我想你应该理解这一部分)
  • ,\r?\n
    行尾
  • [a-zA-Z#,.:-]+
    法律字符
  • ,\r?\n
    行尾
  • [a-zA-Z#,.:-]+
    法律字符

  • $
    字符串的结尾

您的正则表达式有什么问题?
A-z
是打字错误,对吗?必须是
[A-Za-z]
允许我在门号中输入超过4位的数字,超过4位吗?您的模式仅匹配3个字符串(行)。我尝试使用第二个正则表达式。请查看第二个正则表达式。我不明白:您想对所有行使用相同的正则表达式吗?