tracker issue : CF-3695003

select a category, or use search below
(searches all categories and all time range)
Title:

Regex validation of a Colfusion property doesn't work with commas (,)

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Xavier Pujol / Xavier Pujol (Xevi_Pujol)

Created: 01/16/2014

Components: Language, CF Component

Versions: 9.0.1

Failure Type: Crash

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Major / Few users will encounter

Locale/System: English / Linux All

Vote Count: 1

Duplicate ID:	CF-3520983

Problem Description:
For a property with type="string" and validate="regex", the validateparams attribute doesn't parse if there's a comma (,) in the regex pattern used to validate the value against.

Steps to Reproduce:
Consider this component:

component  
    displayname = "My Component"
    accessors = "true"
{
    property
        name = "myProperty"
        type = "string"
        validate = "regex"
        validateparams = "{ pattern = '(Eats)|(Shoots)|(Leaves)|(Eats, Shoots and Leaves)' }";
}

Actual Result:
This throws an error on the instance creation:
myComponentInstance = new myComponent();
/* Error while parsing the validateparam
   '{ pattern = '(Eats)|(Shoots)|(Leaves)|(Eats, Shoots and Leaves)' }'
   for property myProperty */

Expected Result:
I expect the pattern to be parsed, so that "Eats, Shoots and Leaves" is a valid value for the property myProperty

Any Workarounds:
I've tried to escape the comma in multiple ways, but to no avail:
- Using a backslash (\), as a regex escaping character, but this is then processed as a foreslash (/) by ColdFusion:
    validateparams = "{ pattern = '(Eats)|(Shoots)|(Leaves)|(Eats\, Shoots and Leaves)'
    /* Error while parsing the validateparam
       '{ pattern = '(Eats)|(Shoots)|(Leaves)|(Eats/, Shoots and Leaves)' }'
       for property myProperty */
- Using the ASCII character code to escape the comma:
    validateparams = "{ pattern = '(Eats)|(Shoots)|(Leaves)|(Eats#chr(44)# Shoots and Leaves)' }"
- Using a double comma to escape the comma:
    validateparams = "{ pattern = '(Eats)|(Shoots)|(Leaves)|(Eats,, Shoots & Leaves)'

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3695003

External Customer Info:
External Company:  
External Customer Name: Xevi_Pujol
External Customer Email:  
External Test Config: My Hardware and Environment details:

I am on a local development environment, working on a Virtual Machine with CentOS release 6.5.

ColdFusion 9,0,2,282541 Developer edition.

Attachments:

Comments:

http://stackoverflow.com/questions/21115743/regex-validation-of-a-colfusion-property-doesnt-work-with-commas
Comment by External U.
13678 | January 16, 2014 11:19:20 AM GMT
[subscribe] -- Adam ///////////////////
Vote by External U.
13680 | January 16, 2014 11:34:07 AM GMT
Bug Verified. (Comment added from ex-user id:vnigam)
Comment by Adobe D.
13679 | February 13, 2014 04:27:36 AM GMT