Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Regex replacement with params not working right

2. Help
paul t
2013-08-09
2013-08-15
  • paul t
    paul t
    2013-08-09

    Line:
    Log Control {LogLib};U_LOGCTL;1130;Active/Inactive;"Whether the item is active or inactive in its current state";TS_ACTIVEINACTIVE;1519;8d07cbb2-446c-42c6-b703-5f4b7e8a60bc;;18:Active/inactive.;Binary;Listbox;0;;;;;;;;

    Search for:
    ^(.?);(.?);(.?);(.?);(.?);(.?);(.?);(.?);(.?);(.?);(.?);(.?);.*

    Replace with:
    \4 ; \6 ; \10;\11;\12 ; \5

    Gives:
    Active/Inactive ; TS_ACTIVEINACTIVE ; Log Control {LogLib}0;Log Control {LogLib}1;Log Control {LogLib}2 ; "Whether the item is active or inactive in its current state"

    The "\10" "\11" and "\12" replacement params are being interpreted as "\1"_ where _ is 0-2.

    I tried same thing on a test line:
    fld_1;fld_2;fld_3;fld_4;fld_5;fld_6;fld_7;fld_8;fld_9;fld_10;fld_11;fld_12;fld_13;fld_14;fld_15;fld_16;fld_17;fld_18;fld_19;

    And it works.

    Confused am I.

     
    • ${11} and ${12} etc, should be used for replacement groups greater than 9.

       
      • Fool4UAnyway
        Fool4UAnyway
        2013-08-15

        Just to demonstrate the experience I mentioned in another thread, this is what the thread list showed up till now:

        Regex replacement with params not working right
        1 13
        By Dave Brotherstone Dave Brotherstone
        on Fri Aug 09, 2013 07:50 PM

        There was another recent thread which was shown to have a single post with the last one ("that one") made by Dave Brotherstone.

        I was puzzled that Dave would ask a question about regular expressions. Well, he didn't. He had directly replied to the first message in the thread and apparently, then, this reply is not counted as a post.

        It might as well be the case that now the number of posts in this thread is 3, as it should be.