Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    does anyone know anything about regex (formulas)?

    General Discussion
    2
    3
    1898
    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 Blow
      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
      • MAPJe71
        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 Blow
          Joe Blow last edited by

          thanks mapje71

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors