a regexp that allows...

Results 1 to 2 of 2

Thread: a regexp that allows...

  1. #1
    Join Date
    Dec 1969

    Default a regexp that allows...

    digits, commas, and a dollar sign. reason why I&#039;d like this is because I have a form field which people will use to input dollar amounts.<BR><BR>I&#039;d like them to be able to put in:<BR>$5000<BR>$5,000<BR>5,000<BR>5000<BR>5000.00 <BR><BR>Thanks for your help!

  2. #2
    Join Date
    Dec 1969

    Default RE: a regexp that allows...

    This should do the trick:<BR><BR>$?((d{0,3},)(d{3},)*d{3})&#124(d+))( .d{2})?<BR><BR>It says, allow for an optional $, then either have 0, 1, 2, or 3 digits followed by a comma, followed by an arbitrary number of three digits, followed by a comma, followed by 3 digits, OR allow for one or more digits. Following this an optional . and 2 digits can be placed...<BR><BR>hth

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts