Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

RefindNoCase

Guest
Sep 23, 2008 Sep 23, 2008
Hello everybody,

I created a code for one of our customer. The code run just find in my sever which is ColdfusionMX. but the customer still running Coldfusion 5. When I run it at the customer sever, I get the error below. Any idea or suggestion?

====================start error
Error Diagnostic Information

An error occurred while evaluating the expression:

<cfset myIndex = REFindNoCase("\b[\w-\._]+@[\w\.-]+\.[\w+\.-]+\s*\b",body,1,"True") />

Error near line 115, column 9.

Bad regular expression
===========================End of error
448
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Sep 27, 2008 Sep 27, 2008
I solved the problem by rewriting the code to be as the one below in order to avoid the escape sequences

<CFSET myIndex = REFindNoCase("([a-zA-Z_0-9-])*([.]?([[:alnum:]_-]+)*)?@([[:alnum:]\-_]+\.)+[a-zA-Z]{2,4}",string,1,"True")>

Mamdoh
Translate
LEGEND ,
Sep 23, 2008 Sep 23, 2008
I can not tell you where or what, but CF5 had much more primitive regex
comprehension. You are apparently using something it does not understand.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 23, 2008 Sep 23, 2008
> I can not tell you where or what, but CF5 had much more primitive regex
> comprehension. You are apparently using something it does not understand.

CF5's regex implementation doesn't support escape sequences.

Best the OP read the docs... this is the best way to find out what is and
isn't supported for a given version.

http://www.adobe.com/livedocs/coldfusion/5.0/Developing_ColdFusion_Applications/regexp.htm

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 23, 2008 Sep 23, 2008
Thank you for your response. Any suggestion on how I can rewrite the code in order to make comparable with CF5?
This code REFindNoCase("\b[\w-\._]+@[\w\.-]+\.[\w+\.-]+\s*\b",body,1,"True") /> is looking for email format in the input variable which is body in this example.

Thank you for your help
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 23, 2008 Sep 23, 2008
> Thank you for your response. Any suggestion on how I can rewrite the code in
> order to make comparable with CF5?

How far have you got trying to do it yourself?

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 24, 2008 Sep 24, 2008
Hi Adam,

I have been trying since yesterday. Any help will be appreciated

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 24, 2008 Sep 24, 2008
> I have been trying since yesterday. Any help will be appreciated

What have you tried, and in what way did it not work?

Did you read the CF5 docs I pointed you at? Did you check to see if there
were CF5 equivalents of the CFMX7 bits that CF5 doesn't support? Because
for most of it, there are direct equivalents.

As far as I can tell there's only one bit of your CFMX7 regex that would
not be quite straight forward to convert to CF5.

However I'm not going to do your work for you, so pony up with where you're
stuck, and let's go from there.

And "I'm stuck with the whole thing" is not a valid answer ;-)

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 27, 2008 Sep 27, 2008
LATEST
I solved the problem by rewriting the code to be as the one below in order to avoid the escape sequences

<CFSET myIndex = REFindNoCase("([a-zA-Z_0-9-])*([.]?([[:alnum:]_-]+)*)?@([[:alnum:]\-_]+\.)+[a-zA-Z]{2,4}",string,1,"True")>

Mamdoh
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources