Click here to Skip to main content
15,900,656 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
<([ivxlcdm]@)> for capture the small roman letters
		
		
i use this wild card for capture the oxidation terms 
like this[ i ,iii, iv, ix
]	
		all are in small case, i am trying to select both small case and uppercase in single wildcard it not worked whats the problem
		
		<([ivxlcdm]@|[IVXLCDM]@)> for capture both caps and small roman letters
Posted

Don't forget that your character class indicates that there is one Roman numeral, not multiple. Also, you might want to add ^ and $ at the beginning/end to indicate that the string starts/ends.
^[ivxlcdm]+|[IVXLCDM]+$

The + indicates: one or more.

If you allow that lowercase and uppercase Roman numerals are mixed, put them all in one character class:
^[ivxlcdmIVXLCDM]+$
 
Share this answer
 
Comments
smksamy 30-Dec-14 9:14am    
bro this is regex if any option without regex , only wildcard
Thomas Daniels 30-Dec-14 9:15am    
What do you mean by "wildcard"? Your question is tagged RegEx so I provided a regex.
In regex [] defines a group of 'on-of-the-values', so in your case it is on from the small or one from the large...
http://regexper.com/#%3C(%5Bivxlcdm%5D%40%7C%5BIVXLCDM%5D%40)%3E[^]
I can not see a reason why not to combine the groups together...
<([ivxlcdmIVXLCDM]+@)>

http://regexper.com/#%3C(%5BivxlcdmIVXLCDM%5D%2B%40)%3E[^]
 
Share this answer
 
v2
Comments
smksamy 30-Dec-14 9:13am    
it gives small letter and caps letter in mixed, any possible way to avoid mixed roman letter like this [ I,ii,iv,ix ,I,II,IV,IX] not this[iI,iX,iVv]
Kornfeld Eliyahu Peter 30-Dec-14 9:17am    
In that case you should look for this: [ivxlcdm]+|[IVXLCDM]+
http://regexper.com/#%5Bivxlcdm%5D%2B%7C%5BIVXLCDM%5D%2B

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