What would be the regular expression to extract 1944 from the following line :
vol. 9, no. 3, pp. 185-197, 1944
1944 is basically the year of Publication that i am trying to extract. I varies between 1900 and 2010.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If it is always the last part in the string, them you may use
$do indicate that, and the year shall always be a 4 digit number, so for that you used{4}.Hence, the regex you want shall be :
\d{4}$And if you ever want to test your regex, there is a pretty neat tool here : http://pagecolumn.com/tool/pregtest.htm , it also has the rules stated on the right side. 🙂