regexp question

Results 1 to 2 of 2

Thread: regexp question

  1. #1
    Join Date
    Dec 1969

    Default regexp question

    Is there a way to create an "AND" statement in a regular expression?<BR><BR>For example, I&#039;m using this regexp...<BR>$?((d{0,3},)(d{3},)*d{3})&#124(d+)(.d {2})?<BR> do data validation which will accept $300,000 or 300,000 or 300000 or 300000.00 as valid entries.<BR>The problem I&#039;m running into is that a user could still put an alphabetical character at the end of their number like 300,000as and it will accept this as a valid entry. This is causing problems for me because I get a type mismatch error when such an entry is sent to my database which is expecting a "money" datatype.<BR><BR>The regular expression is working as it should. It matches the pattern and then moves on. Problem is that it doesn&#039;t exclusively demand that the pattern match exactly without alphabetical characters coming before or after the pattern. I hope that makes sense.<BR><BR>It would seem to me that if I could add an "AND" statement to the regular expression which would check for the pattern I&#039;ve set up above, AND THEN go back and check through to make sure that only numeric characters, commas, and/or dollar signs have been used throughout the entry, I could ensure the integrity of the data.<BR><BR>Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: regexp question

    I wouldnt go this route.<BR><BR>Look up in the docs and read up on how to check the different datatypes<BR><BR>IF isDate then<BR><BR>Use that to determine is you are getting something valid before trying to put it in database.

Posting Permissions

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