Regular Expressions
-
Does any one have a decent regular expression for money. I am struggling to get one together, however I need one that matches for something like this: a dollar sign($) 1-4 digits 1-999 two decimal places 1.50 0 and will allow a blank textbox. If anyone has a regex for this or could point me to a utility that would do so, your help is greatly appreciated. thanks
-
Does any one have a decent regular expression for money. I am struggling to get one together, however I need one that matches for something like this: a dollar sign($) 1-4 digits 1-999 two decimal places 1.50 0 and will allow a blank textbox. If anyone has a regex for this or could point me to a utility that would do so, your help is greatly appreciated. thanks
Maybe this will get you started: ^\${1}\d{1,4}\.\d{2}$ That will match stuff like $123.45. Note that it may not be perfect; please test it thoroughly before putting it into production. For what it's worth, I don't know much about regular expressions; I simply I generated that using the free Readable Regex[^] library, using the following code:
string pattern = Pattern.With.AtBeginning.Literal("$").Repeat.Exactly(1)
.Digit.Repeat.InRange(1, 4)
.Literal(".")
.Digit.Repeat.Exactly(2).AtEnd.ToString();Tech, life, family, faith: Give me a visit. I'm currently blogging about: The Lord Is So Good The apostle Paul, modernly speaking: Epistles of Paul Judah Himango
-
Does any one have a decent regular expression for money. I am struggling to get one together, however I need one that matches for something like this: a dollar sign($) 1-4 digits 1-999 two decimal places 1.50 0 and will allow a blank textbox. If anyone has a regex for this or could point me to a utility that would do so, your help is greatly appreciated. thanks