Loading ...
Sorry, an error occurred while loading the content.

22384Re: [Clip] using regex $1 followed by a number ... how to

Expand Messages
  • Don
    Dec 29 7:59 PM
    • 0 Attachment
      On 12/29/2011 10:41 PM, John Shotsky wrote:
      > Your question is a little confusing, but if you want a number in the replace section, simply escape it. $1\0, for
      > example.
      > Regards,
      > John

      Other than using the word space when I mean trailing zero, my question
      seemed and seems clear to me :-) I'm glad you were able to offer the

      In fact your solution seems to work. So somehow the \ seemed to stop or
      delimit the $1 so that the zero is a zero.

      Help on RegEx substring replace says thus:
      "\ The backslash character: '\' is used as a general escape. Unless the
      following character has a special meaning (listed below), it is inserted

      As zero has no special meaning I'd have expected the literal insertion
      of the back slash.

      However looking above it says this:
      To insert the 1st substring directly followed by a digit, escape the
      digit using a backslash: '\$16' inserts the 16th substring, while
      '\$1\6' inserts the 1st substring followed by the literal '6'.

      However in my testing I didn't have to and could not escape the $ to
      delimit the substring identifier \$1\ which might make more sense to me.
      However when I test this, it appears to not be true, at least with the
      search and replace dialog:
      text: 5
      replace: (5)
      with: \$1\05
      yields: $105

      On the other hand:
      text: 5
      this: (5)
      replaced with: $1\05
      yields: 505

      so help appears to be half right :-)
    • Show all 5 messages in this topic