Community
    • Login

    help with formula

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 2 Posters 3.8k Views 1 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

      ok I’m getting flagged as spam (not sure why) so I’m going to try to post this…

      question
      I need to add in two lines of text
      training 57
      and
      tazertrained true

      after the line:
      BodyArmour StabVest

      and before the line
      END

      do you know how to add in the two last lines
      note: they should be indented

      http://www78.zippyshare.com/v/r6Sh5S7m/file.html
      screenshot

      1 Reply Last reply Reply Quote 0
      • guy038G Online
        guy038
        last edited by guy038

        Hello Joe,

        If I refer, strictly to your picture, it seems that your blank characters are tabulations, of size = 4 and that the text must be added in the split line 191, with indentation. If this is correct I would say, in regular expression search mode :

        SEARCH = \tBodyArmour\t+StabVest\R(?=END)

        REPLACE = $0\tTraining\t\t\t57.06245\r\n\tTazerTrained\t\ttrue\r\n

        Click on the button Replace to add the two lines Training… True, after the selection, or on the Find Next button to search the next group BodyArmour…END

        Notes :

        • The escaped character \t represents a tabulation character

        • The \R syntax stands for any kind of End of Line

        • In replacement, the syntax $0 is the whole searched match, that is to say, the string from the tabulation before BodyArmour to the two End of Line characters, included

        • Note that the key-word END is NOT included in the whole searched match, although it’s a condition, enclosed in a positive look-ahead, that must be verified to get a global positive match !

        • In replacement, the syntax \R is forbidden and you must to change it into \r\n, for Windows files or into \n, for Unix files

        So, from the text :

        	BodyArmour			StabVest
        END
        

        We get the new text, below :

        	BodyArmour			StabVest
        	Training			57.06245
        	TazerTrained		true
        END
        

        Just tell me if you would prefer to search and replace, directly, in NOT split lines , as all the lines different from #191

        Best Regards,

        guy038

        1 Reply Last reply Reply Quote 1
        • Joe BlowJ Offline
          Joe Blow
          last edited by

          that’s great…just what I needed. thanks again guy038

          1 Reply Last reply Reply Quote 0
          • Joe BlowJ Offline
            Joe Blow
            last edited by

            i misread your response, the blank characters are tabs of size 8…
            (except for the “begin” and “end” lines they are 4.)…every thing else is correct in your interpretation of the picture. (a few lines start at the very first character…the rest of the lines are tabulations of either 4 or 8.

            using the 8 tabulation…what would the search and replace formula look like?

            1 Reply Last reply Reply Quote 0
            • Joe BlowJ Offline
              Joe Blow
              last edited by

              http://www69.zippyshare.com/v/0BUpiELZ/file.html

              the file, so you see the whole picture (Notepad++ doc)
              p.s. use the download link that’s on the right…the other is for zip share software.

              1 Reply Last reply Reply Quote 0
              • Joe BlowJ Offline
                Joe Blow
                last edited by

                ps the file is safe to download i used several virus programs…
                windows must not like that site…or maybe its just my windows that doesn’t like it, … just click and override the notice to download.

                i have uploaded it to a new site, in case you don’t want to download that one…

                http://www.filedropper.com/example1

                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