简体   繁体   English

正则表达式小写字母后跟一个数字

[英]Regular expression lowercase letter followed by a number

I'm trying to get the hang of regular expression. 我正试着抓住正则表达式。 I'm scanning through an xml file and I want to do is find any word starting with a lowercase letter fallowed by a number eg c1234 I assume it's something like [az 0-9] but it's finding single characters instead of a whole word. 我正在扫描xml文件,我想做的是找到以小写字母开头的任何单词,例如c1234我认为它类似于[az 0-9]但是它找到的是单个字符而不是整个单词。 Any ideas on how to do this would really be appreciated. 关于如何做到这一点的任何想法将非常感激。

[az]\\d+ will work just fine. [az]\\d+将正常工作。

It looks for any lowercase letter followed by any amount of digits. 它会查找任何小写字母,后跟任意数量的数字。

About regex you can read here: https://msdn.microsoft.com/ru-ru/library/az24scfc(v=vs.110).aspx 关于正则表达式,你可以在这里阅读: https//msdn.microsoft.com/ru-ru/library/az24scfc(v=vs.110).aspx

test your regex you can here: http://www.regexlib.com/RETester.aspx 你可以在这里测试你的正则表达式: http//www.regexlib.com/RETester.aspx

I think, you help this construction: \\b[az]\\d+ 我想,你帮助这个结构: \\b[az]\\d+

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM