Click here to Skip to main content
14,928,120 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>
   
Comments
   
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
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
   

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