does anyone know anything about regex (formulas)?



  • for example,

        BodyArmour           StabVest  
        Training             99.99999  
        TazerTrained         true  
    END
    

    and

        BodyArmour           StabVest  
    END
    

    now I use this:
    BodyArmour .+ StabVest
    to find what
    and I use this:
    $0\n\t\tTraining\t\t\t 99.99999\r\n\t\tTazerTrained\t\t true
    to replace…

    trouble is everytime I find and replace I end up adding extra training and tazertrained lines to lines that already have them…

    QUESTION: Does anybody know a way around that…I only want to replace the ones that don’t already have training and tazertrained after them. (ie the 2nd example)

    here is a file for testing (if you need it)
    http://www.filedropper.com/test_257



  • Find what:

    (BodyArmour[\t ]+StabVest[\t ]*)(\r?\n|\r)((?:\t| {4})END)
    

    Replace with:

    $1$2\t\tTraining\t\t\t 99.99999$2\t\tTazerTrained\t\t true$2$3


  • thanks mapje71


Log in to reply