Click here to Skip to main content
15,889,651 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
Hi,
Input:
He was born in 18th century.
He lived in 21st century.


Output:

18th
21st
Posted

1 solution

Try this:
\b\d{1,2}(st|th)\b
 
Share this answer
 
Comments
Member 10391350 16-Apr-14 8:27am    
Thanks
Peter Leow 16-Apr-14 10:19am    
You are welcome.
[no name] 16-Apr-14 8:38am    
+++5
Peter Leow 16-Apr-14 10:20am    
Thanks Rakesh.

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