Community
    • Login

    does anyone know anything about regex (formulas)?

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 2.4k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          Joe Blow
          last edited by

          thanks mapje71

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors