注册。正则表达式 [英] Reg. Regular Expression

查看:74
本文介绍了注册。正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我为以下字符串准备了正则表达式。



1。 R53V10114-00



这里 - 00是可选的,意味着它可以在那里,但不能。



但如果它在那里那么它应该只有格式 -00到-99 范围,包括 -



如何为字符串 -00 构建正则表达式?

解决方案

尝试:

( -  \\\)?


Something喜欢: -\d\d



如果你去 http://www.regexr.com/ [ ^ ],你可以为自己学习和实验。


尝试这样的模式:

 \\ \\w {9}( -  \d {2})?

Hi,

I have prepared the regular expression for the following string.

1. R53V10114-00

Here "-00" is optional means if it can be there and can't.

but if it's there then it should be only in format -00 to -99 range including -

How can I build the regular expression for the string -00 ?

解决方案

Try:

(-\d\d)?


Something like : -\d\d.

And if you go to http://www.regexr.com/[^], you can learn and experiment for yorself.


try pattern like this:

\w{9}(-\d{2})?


这篇关于注册。正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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