Re: How do you allow accented characters in a cfinput regex?
OK, I think I tried what you suggested--here is exactly what I did: Added this to the page: cfprocessingdirective pageencoding=utf-8 Made the cfinput: cfinput type=text name=FName required=yes size=30 validate=regex pattern=[:alpha:] message=Please enter a valid First Name This now allows nearly anything in the field, including characters that are not valid in names, such as $ or slash. It also leaves out the {2,50} length spec. So it doesn't seem to do what I need. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352650 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
Did you try setlocale on the string as per previous example? Regards Russ Michaels On Sep 17, 2012 3:56 AM, John Pullam jpul...@mcleansystems.com wrote: When I use this pattern=^[[:alpha:]'\-\ ]{2,50}$ nothing validates. Is that what you meant? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352640 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
Did you try setlocale on the string as per previous example? Sorry but I'm not clear on how I would use that, so please help me understand. For background information, this is a form field coming in to a CFFORM that I am checking with CFINPUT regex validation. I don't want to force someone to use a character set for a different country, I just want my string to be checked for accented characters. Do I need a setlocale to do that? If yes, what would I do with it? What locale would I use to accept all types of accented characters? This is obviously over my head. Sorry ... ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352641 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
On 9/17/2012 9:23 PM, John Pullam wrote: Did you try setlocale on the string as per previous example? not needed in this instance. did swapping [:alpha:] for \w in the regex expression work or not? if not, what version of cf? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352646 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
did swapping [:alpha:] for \w in the regex expression work or not? if not, what version of cf? No, it started rejecting all names when I did that. I am running CF9. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352647 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
On 9/18/2012 7:31 AM, John Pullam wrote: No, it started rejecting all names when I did that. I am running CF9. you're doing it wrong: cfprocessingdirective pageencoding=utf-8 cfscript x=Tá mé in ann gloine a ithe; Ní chuireann sé isteach nó amach orm.; writeoutput('reFind says: #reFind([[:alpha:]],x)#brbr'); /cfscript cfform format=html method=post cfinput name=test validate=regular_expression pattern=[:alpha:] value=#x#/ /cfform ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352648 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
On 9/18/2012 11:05 AM, Paul Hastings wrote: x=T� m� in ann gloine a ithe; N� chuireann s� isteach n� amach orm.; that didn't come through so good, grab one of the test phrases from http://www.sustainablegis.com/unicode/ ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352649 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
How do you allow accented characters in a cfinput regex?
I've read a whole bunch and tried many things but I can't seem to get my regex pattern to allow accented characters, which will occur in people's names. My cfinput currently looks like this: cfinput type=text name=FName required=yes size=30 validate=regex pattern=^[\w'\-\ ]{2,50}$ message=Please enter a valid First Name It is fine on non-accented names like John or hyphenated names but as soon as I enter a name with accents, it posts an error. For example, Agnès. I've played with other versions including :alpha: and [A-Za-zÀ-ÿ'\-\ ] but nothing seems to work correctly. Sure would appreciate some help on this ... what am I missing? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352628 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
http://www.regular-expressions.info/unicode.html It is possible that cf regex doesn't support unicode, so you should perform some basic tests to confirm that, plus make sure the string your testing is in unicode format Regards Russ Michaels On Sep 16, 2012 3:45 PM, John Pullam jpul...@mcleansystems.com wrote: I've read a whole bunch and tried many things but I can't seem to get my regex pattern to allow accented characters, which will occur in people's names. My cfinput currently looks like this: cfinput type=text name=FName required=yes size=30 validate=regex pattern=^[\w'\-\ ]{2,50}$ message=Please enter a valid First Name It is fine on non-accented names like John or hyphenated names but as soon as I enter a name with accents, it posts an error. For example, Agnès. I've played with other versions including :alpha: and [A-Za-zÀ-ÿ'\-\ ] but nothing seems to work correctly. Sure would appreciate some help on this ... what am I missing? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352629 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
Sorry I don't know how to do that. How do you put a string in unicode format? http://www.regular-expressions.info/unicode.html It is possible that cf regex doesn't support unicode, so you should perform some basic tests to confirm that, plus make sure the string your testing is in unicode format Regards Russ Michaels On Sep 16, 2012 3:45 PM, John Pullam jpul...@mcleansystems.com wrote: ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352635 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
John, Larry had a great post on this a while ago.. http://www.larryullman.com/forum/read.php?19,44246 Thanks, Brian On Sep 16, 2012 10:45 AM, John Pullam jpul...@mcleansystems.com wrote: I've read a whole bunch and tried many things but I can't seem to get my regex pattern to allow accented characters, which will occur in people's names. My cfinput currently looks like this: cfinput type=text name=FName required=yes size=30 validate=regex pattern=^[\w'\-\ ]{2,50}$ message=Please enter a valid First Name It is fine on non-accented names like John or hyphenated names but as soon as I enter a name with accents, it posts an error. For example, Agnès. I've played with other versions including :alpha: and [A-Za-zÀ-ÿ'\-\ ] but nothing seems to work correctly. Sure would appreciate some help on this ... what am I missing? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352636 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
Most if the stuff in that post refer to more general regex processing, not the ColdFusion implementation. When I tried his syntax, CF failed with errors because it doesn't appear to be recognized. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352637 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
On 9/16/2012 9:45 PM, John Pullam wrote: cfinput type=text name=FName required=yes size=30 validate=regex pattern=^[\w'\-\ ]{2,50}$ message=Please enter a valid First Name change \w to [:alpha:] ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352638 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How do you allow accented characters in a cfinput regex?
When I use this pattern=^[[:alpha:]'\-\ ]{2,50}$ nothing validates. Is that what you meant? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352639 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm