Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
my requirement is select the combination of roman letters terms in document, that terms may be in small letters or caps letters, not be in mixed (IiVx)

SQL
i use the regex format for select the terms

regex = new Regex(@"\b([ivxlcdm]+|[IVXLCDM]+)\b");

but document contains ALLCAPS format terms they didnt select by regex , any one help to me
Posted

You can try this expression
(?<roman>\b[IVXLCDM]+\b)|(?<roman>\b[ivxlcdm]+\b)

It basically says, either small letters OR (|) capital letters, but not both.
Make sure you turn off IgnoreCase.
 
Share this answer
 
v2
Comments
smksamy 3-Jan-15 1:45am    
Thank You George , It works Now
George Jonsson 3-Jan-15 3:15am    
You are welcome.
smksamy 3-Jan-15 4:00am    
http://www.codeproject.com/Questions/859313/ALLCAPS-value-cant-convert-to-other-other-cases-an

George do u have any solution to this problem
Book mark this: https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch06s09.html[^]
The above is for finding All-Cap Roman Numerals. Check against this, if fail, then have another similar regex check for small cap, just convert all the letters in the previous regex to small ones. Or
(ALL-CAP regex)|(small cap regex)

Learn more: The 30 Minute Regex Tutorial[^]
 
Share this answer
 
v3

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