定期表达接受NA和数字 [英] Regular expresion to accept NA and numbers

查看:87
本文介绍了定期表达接受NA和数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我尝试了一个只接受数字和NA的正则表达式模式,但我无法找到解决方案。对此的任何指导都会有很大的帮助

Hi
I have tried a regex-pattern that should accept only numbers and NA but I cannot arrive at a solution.Any guidance on this will be of great help

推荐答案

请阅读Zoltan的Zorgo评论。



最简单的正则表达式模式是: \d + |(NA)

其中:

\d + - 任何数字[0-9](一场或多场比赛)

| 替代(或)

(NA) - NA



请看看这里:http://www.regular-expressions.info/reference.html [ ^ ]
Please, read Zoltan''s Zorgo comment.

The simplest regex pattern is: \d+|(NA).
where:
\d+ - any digit [0-9] (one or more matches)
| alternative (or)
(NA) - "NA"

Please, have a look here: http://www.regular-expressions.info/reference.html[^]


这篇关于定期表达接受NA和数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆