2 Replies Latest reply on Nov 20, 2007 10:18 AM by gr8white

    backreference with ReReplace

    gr8white Level 1
      I'm hung up on something I thought would be fairly simple. I want to add a zero to the end of a string of digits using ReReplace. But the zero needs to be escaped as otherwise CF interprets it as part of the backreference. To boil it down to the bare bones (actually part of something a lot more complex):
      REReplace("123","([0-9]{3})", "\10")
      returns empty string as CF thinks it's 10 instead of 1
      REReplace("123","([0-9]{3})", "\1\0")
      returns 123123 for reasons I'm not certain but maybe CF sees \0 as equivalent to \1
      REReplace("123","([0-9]{3})", "\1\\0")
      returns 123\0

      I've tried everything else I can think of with no success. ANy help appreciated.

      Thanks,
      Ken