Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

C#
Regex regex1 = new Regex(@"^[w*\d]+$");
Posted
Updated 13-Jul-16 4:24am

Try:
[a-zA-Z]+\s\d{1,4}


Get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.
 
Share this answer
 
Comments
Member 10527033 13-Jul-16 8:24am    
it worked thank you
OriginalGriff 13-Jul-16 10:03am    
You're welcome!
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.[^]
 
Share this answer
 
A very helpful site is regexlib[^] they have a large library of Regular Expressions. They also have a RegEx tester[^]. Also Expresso[^] is a very useful RegEx tool.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900