Solved

Regular Expressions

Posted on 2004-09-27
2
168 Views
Last Modified: 2013-12-24
I am trying to stop users from entering an id number (which has to be between 1 and 11 chars in length) that is all zeros like so "000" or "0000000000" but they can enter in BLL00ssa
I started with this
<cfif not findNoCase('[1-9]+[a-z]+[A-Z]',id)>
      <script language="JavaScript">
        self.opener.zeros();
      </script>
      <script language="JavaScript">
            self.close ();
            window.close ();
      </script>


</cfif>
but as U can see it does not work
0
Comment
Question by:CFDevHead
2 Comments
 
LVL 5

Expert Comment

by:smaglio81
ID: 12161149
It might be a typo but you are using findNoCase, since you are looking to use Regular Expressions, you might want to try using REFindNoCase().

I would probably be best to review the CFML Reference page for REFindNoCase (http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/functa64.htm#wp1111121).

If the regular expressions become to cumbersome, you might want to just hard code in the 11 <cfif> statements that would check for the taboo strings.

Best of luck,

Steven
0
 
LVL 15

Accepted Solution

by:
danrosenthal earned 500 total points
ID: 12163823
<CFSET idnumber = "000000000">

<CFIF REFIND("^[0]+$",idnumber)>
  All Zeroes!!<CFABORT>
</cfif>

0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question