I have a below string to compare in PHP.and i made one regular expression for match the string.But it only match exactly same string so can some one help to get me regular expression to match below conditional string.
我有一个下面的字符串来比较PHP.and我做了一个正则表达式匹配字符串。但它只匹配完全相同的字符串所以可以有一个帮助让我正则表达式匹配下面的条件字符串。
I have used below expression.
我用过以下表达式。
[poBox]\s\d{3}
below is my conditional string to match
下面是我要匹配的条件字符串
POBox 123, POBox 1234, P.O.Box 123, P.O.Box 1234, P O Box 123, P O Box 1234, P.O. Box 123, P.O. Box 1234
1 个解决方案
#1
2
[poBox]
means any one character between p
, o
, B
or x
. And \d{3}
will not match the full extent of 1234
.
[poBox]表示p,o,B或x之间的任何一个字符。并且\ d {3}将不匹配1234的全部范围。
P\.?\s?O\.?\s?Box\s\d+
#1
2
[poBox]
means any one character between p
, o
, B
or x
. And \d{3}
will not match the full extent of 1234
.
[poBox]表示p,o,B或x之间的任何一个字符。并且\ d {3}将不匹配1234的全部范围。
P\.?\s?O\.?\s?Box\s\d+