Skip navigation
Currently Being Moderated

REreplaceNoCase and "<br />" issue

Aug 8, 2012 10:03 AM

Hello, everyone.

 

I am using JavaScript to replace line breaks from a textarea with "<br />" before submitting the form, and that part is working flawlessly.

 

Where I'm having an issue is trying to replace the "<br />" with chr(13) & chr(10) in the data pulled from the database when trying to edit the value.  I'm using REreplaceNoCase() but I'm not sure how to tell the CF RegEx engine what to look for.

 

Here is what I'm using to insert the line breaks for HTML:

document.formName.fieldName.value = document.formName.fieldName.value.replace(/(\r\n|\r|\n)/g,"<br />");

 

Here is how I'm attempting to reformat for editing inside the textarea:

#REreplaceNoCase(qry.columnName,"<br />",chr(13) & chr(10),"all")#

 

But the REreplaceNoCase isn't finding any of the "<br />" that is in the value.  How should the RegEx be formatted to find the "<br />"?

 

Respectfully,

 

^_^

 
Replies
  • Currently Being Moderated
    Aug 8, 2012 10:33 AM   in reply to WolfShade

    I think the issue is that you are using REreplaceNoCase but you are not specifying a regular expression.  Why not try using just ReplaceNoCase exactly as you have.  I think that will work for you.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 8, 2012 10:59 AM   in reply to WolfShade

    I'd use replace instead of rereplace for something that simple.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points