Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Please provide me solution of regular expression for numeric value which allow multiple comma's like indian currency format

output exp. 1,21,31,456


thanks
Posted

hi,

better to use filter text box where you can specify the character you need


XML
<cc1:filteredtextboxextender id="FilteredTextBoxExtender4"  runat="server" filtertype="Numbers">
                                                            TargetControlID="txtGsmNo">
                                                        </cc1:FilteredTextBoxExtender></cc1:filteredtextboxextender>
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Jun-11 2:30am    
Yes, this is better, my 5. On top of it, (further) validation can be used, on server side.
--SA
anvas kuttan 7-Jun-11 2:33am    
Thank You SA
 
Share this answer
 
Use this regex: ^\d+([,]\d+)*$

C#
bool valid = System.Text.RegularExpressions.Regex.IsMatch("1,21,31,456", @"^\d+([,]\d+)*$");
// valid is true

bool valid = System.Text.RegularExpressions.Regex.IsMatch("1,21", @"^\d+([,]\d+)*$");
// valid is true

valid = System.Text.RegularExpressions.Regex.IsMatch("1,21,31,456", @"^\d+([,]\d+)*$");
// valid is false
 
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