本文介绍了Regexp检测邮政信箱的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




是否有人有代码检测是否已在PO中输入字段

Box格式?我正在努力阻止用户进入邮政信箱以获取

送货地址。


谢谢, - Dave

Hi,

Does anyone have code that detects if a field has been entered in PO
Box format? I''m trying to prevent users from entering PO Boxes for
shipping addresses.

Thanks, - Dave

推荐答案



什么国家/地区,格式是什么?


如果您能给出合理定义什么是PO-box字符串和什么

不是,应该可以进行正则表达式测试。


-

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)

What country, what format?

If you ca give a reasonable definition of what is a PO-box string and what
is not, a regex test should be possible.

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)




什么国家/地区,格式是什么?


如果您可以合理地定义什么是PO-box字符串和什么

不是,应该可以进行正则表达式测试。


-

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)


What country, what format?

If you ca give a reasonable definition of what is a PO-box string and what
is not, a regex test should be possible.

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)



该国家/地区是美国。我对邮政信箱的理解是它的形式是PO Box ####,其中#是一个介于0和

之间的数字9.但是数字的数量可以是无限的,我想并且那里的b / b可以是PO Box的变化。是写的,例如如果标点符号

包含在某处。 - Dave

The country is the United States. My understanding of a PO Box is
that it is of the form PO Box #### where "#" is a number between 0 and
9. But the number of numbers could be unlimited, I suppose and there
could be variation in how "PO Box" is written, e.g. if punctuations
are included somewhere within. - Dave



什么国家,什么格式?

如果你能给出一个合理的定义什么是PO-box字符串
和什么不是,应该可以进行正则表达式测试。

- Evertjan。
荷兰。
(请在我的电子邮件地址中将x'变为点数)


What country, what format?

If you ca give a reasonable definition of what is a PO-box string
and what is not, a regex test should be possible.

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)



这个国家是美国。我对邮政信箱的理解是它的形式是PO Box ####,其中#是一个介于0和

之间的数字9.但是数字的数量可以是无限的,我想并且那里的b / b可以是PO Box的变化。是写的,例如如果标点符号

包含在某处。 - 戴夫


The country is the United States. My understanding of a PO Box is
that it is of the form PO Box #### where "#" is a number between 0 and
9. But the number of numbers could be unlimited, I suppose and there
could be variation in how "PO Box" is written, e.g. if punctuations
are included somewhere within. - Dave



非常简单的正则表达式

/ PO \ + + Box \s + \d + / i

会有效。


试试这样:

< script type =" text / javascript">

<! -

var f = / PO \ + + Box \s + \d + / i;

var q =''Po Box 33'';

alert(f.test(q));

// - >

< / script>

Very simplistically the regex
/PO\s+Box\s+\d+/i
will work.

Try it out like this:
<script type="text/javascript">
<!--
var f = /PO\s+Box\s+\d+/i;
var q = ''Po Box 33'';
alert(f.test(q));
// -->
</script>


这篇关于Regexp检测邮政信箱的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 11:58