我需要一个正则表达式来接受一个以word开头并以数字结尾的字符串 [英] I need a regex to accept a string that starts with word and ends with a number
本文介绍了我需要一个正则表达式来接受一个以word开头并以数字结尾的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要求只获取以word开头并以数字结尾的数据
数据将类似于
< b / b
2011财年,2012财年,2016财年expt,2014财年,2015财年expt等
i需要以格式单词年份获取所有数据( 2011财年)
请帮我完成这个
提前致谢
我尝试过:
i已尝试使用以下正则表达式...但它失败了。
i have a requirement to get only data that starts with word and ends with a number
the data will be like
FY 2011, FY 2012, FY 2016 expt, FY 2014, FY 2015 expt etc
i need to get all data with format word Year(FY 2011)
please help me complete this
Thanks in advance
What I have tried:
i have tried with below regex...but it fails.
Regex regex1 = new Regex(@"^[w*\d]+$");
推荐答案
);
尝试:
Try:
[a-zA-Z]+\s\d{1,4}
获取 Expresso 的副本[ ^ ] - 它是免费的,它会检查并生成正则表达式。
Get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.
A几个链接
在线RegEx测试员:
.NET Regex Tester - Regex Storm [ ^ ]
和另一个有一个很好的图表您的RegEx:
Debuggex:在线可视正则表达式测试器。 JavaScript,Python和PCRE。 [ ^ ]
A few links
an online RegEx tester:
.NET Regex Tester - Regex Storm[^]
and another one with a nice graph of your RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
这篇关于我需要一个正则表达式来接受一个以word开头并以数字结尾的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文