2 Replies Latest reply: May 6, 2014 1:11 AM by Arpod RSS

    4.0.1 Regular Expression replace with capturing groups - regression?

    Arpod

      In version 3.2 it was possible to reference a captured group in the replace string, using \1, \2 etc. It doesn't seem to work anymore in 4.0.1, which is pretty annoying, because I use it often.

       

      Suppose I have the following text:

       

      a bcd efgh ik
      

       

      I want to prefix every letter with 'a-'. I search for:

       

      ([A-z])

       

      and replace it with:

       

      a-\1

       

      In 3.2 I get what I would expect:

       

      a-a a-ba-ca-d a-ea-fa-ga-h a-ia-k 
      

       

      But 4.0.1 doesn't seem to understand the reference:

       

      a-\1 a-\1a-\1a-\1 a-\1a-\1a-\1a-\1 a-\1k
      

       

      I tried $1 and \\1, also tried turning "Substitute escaped characters" on and off, with no result.

      Furthermore, it ignores the last letter, 'k'.

       

      I'm not sure, but I think it worked fine in 4.0.0. I couldn't find any information on regexp replace syntax in the help, either - maybe I'm just doing something wrong?