This is a minor but important fact that I just realized. ColdFusion's CFParam tag regular expression validation tests its pattern on the entire value in question. This means that you don't have to worry about partial string matches. What this means is that you never need to use the start (^) and end ($) delimiters as these are applied implicitly. So, for example, the CFParam tag:
- <cfparam name="name" type="regex" pattern="naomi" />
... is really implicitly applying the pattern:
This is good to know, as I had previously been using the start and end line delimiters. But, this also lead to a new realization - pattern flags don't have to be the very first thing in a regular expression pattern. These patterns are case-sensitive, so you if you wanted to make it case-insensitive, you would have to add the "i" flag:
- <cfparam name="name" type="regex" pattern="(?i)naomi" />
Of course, this is actually applying the pattern:
I used to think that the pattern flags (?i) had to be the very first thing in the pattern, but apparently not (and the RegEx Coach confirms this as well).
So again, this is really minor, but an important point to understand.
Looking For A New Job?
- Senior Application Developer (Coldfusion) at American Access Casualty Company
- Front end engineer - AngularJS focus at Corbis
- Senior Web Application Developer at SiteVision, Inc.
- ColdFusion Developer Needed at AutoConX Systems
Thanks again Ben! Saved me all kinds of frustration finding my "order by" query paramming helper broke when enforcing uppercase column names for Oracle... all I needed was the (?i) case insensitivity attribute on my regex.