Solved

Regular Expressions

Posted on 2004-09-27
2
169 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 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