Sometimes when coding applications, your run into problems that seem to be easy to fix but end up being very difficult to fix in a standard way. Now here was my situation.

  1. One stock web form
  2. One stock asp.net textbox control
  3. One stock asp.net regular expression validator
  4. One stock asp.net button

Problem: This textbox was for number data entry. It should accept number values such as 1, 50, 897, or 2,309. Now initial thoughts say that this should be a easy regular expression.

Solution: After a lot of trial and error I finally end up with this regular expression: -?([1-9][0-9]{0,2}(,[0-9]{3,3})*|0|[1-9]{1}[0-9]*)

And finally for the funny part of this post. I pasted my regex in a chat with my body and got this response. HAHAHAHAHAHAHAH!

reactor:     -?([1-9][0-9]{0,2}(,[0-9]{3,3})*|0|[1-9]{1}[0-9]*)  
reactor:     look at that nugget   
k00k|wrk:     lol 
k00k|wrk:     jeez 
k00k|wrk:     good work 
k00k|wrk:     you just got the combination to my luggage 
reactor:      lol 

Aren't friends great for a laugh?