Community
    • Login

    does anyone know anything about regex (formulas)?

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 2.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Joe BlowJ
      Joe Blow
      last edited by Joe Blow

      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

      1 Reply Last reply Reply Quote 0
      • MAPJe71M
        MAPJe71
        last edited by

        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
        
        1 Reply Last reply Reply Quote 0
        • Joe BlowJ
          Joe Blow
          last edited by

          thanks mapje71

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors