1 Reply Latest reply on Jul 24, 2006 12:53 PM by Newsgroup_User

    Replace chr(10) with <br> unless between table tags?

    jimmy.hunt Level 1
      How do I replace any chr(10)'s with a br unless the chr(10) are within a table tag?

      If a user enters this, into a record, I don't want the BRs to be placed in the table.

      <table>
      <tr>
      <td>
      </td>
      </tr>
      </table>

      <cfset resolution2 = #Replace(resolution,"#chr(10)#","<br>","all")#>

      Any clues?

      Thanks!
        • 1. Re: Replace chr(10) with &lt;br&gt; unless between table tags?
          Level 7
          You could probably do this with a regular expression and ReReplace().
          But I am not strong enough at regex to actually give some code.

          jimmy.hunt wrote:
          > How do I replace any chr(10)'s with a br unless the chr(10) are within a table
          > tag?
          >
          > If a user enters this, into a record, I don't want the BRs to be placed in the
          > table.
          >
          > <table>
          > <tr>
          > <td>
          > </td>
          > </tr>
          > </table>
          >
          > <cfset resolution2 = #Replace(resolution,"#chr(10)#","<br>","all")#>
          >
          > Any clues?
          >
          > Thanks!
          >