• Login
Community
  • Login

Paste every "say 37th line" apx..

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
30 Posts 3 Posters 1.7k 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.
  • C
    Carolina Number 1 @Carolina Number 1
    last edited by Feb 27, 2021, 1:28 PM

    @Carolina-Number-1

    not sure about what of this goes in the search line?
    After searching for the line isuserselectable = 0 ; flag off for non selectable planes, respecting the case (?-i) and its line-ending characters \R, the \K feature resets the search and simply matches the zero-length location, right after this line

    1 Reply Last reply Reply Quote 0
    • C
      Carolina Number 1 @Alan Kilborn
      last edited by Carolina Number 1 Feb 27, 2021, 1:32 PM Feb 27, 2021, 1:31 PM

      @Alan-Kilborn

      not sure about what of this goes in the search line?
      After searching for the line isuserselectable = 0 ; flag off for non selectable planes, respecting the case (?-i) and its line-ending characters \R, the \K feature resets the search and simply matches the zero-length location, right after this line

      once i get the hang of this…then i have maybe 100 more airplanes …lol

      A 2 Replies Last reply Feb 27, 2021, 1:38 PM Reply Quote 0
      • A
        Alan Kilborn @Carolina Number 1
        last edited by Feb 27, 2021, 1:38 PM

        @Carolina-Number-1

        So, when @guy038 said:

        SEARCH (?-i)isuserselectable = 0 ; flag off for non selectable planes\R\K

        REPLACE sound = “sound” ; sound folder\r\n ( OR sound = “sound” ; sound folder\n if UNIX files )

        He meant for “SEARCH” that you would put this in the box labeled Find what:

        And correspondingly, “REPLACE” means look for the Replace with box.

        Does that help?

        C 1 Reply Last reply Feb 27, 2021, 1:43 PM Reply Quote 2
        • C
          Carolina Number 1 @Alan Kilborn
          last edited by Feb 27, 2021, 1:43 PM

          @Alan-Kilborn

          yeah…I think I lost my “isuserselectable = 0 ; flag off for non selectable planes” because it replaced it with the sound stuff…lol but it added sound i think 736 times…so rather than replace that line…insert the sound line below it…this was on a trial cfg not the real one yet till i get this down.

          1 Reply Last reply Reply Quote 0
          • A
            Alan Kilborn @Carolina Number 1
            last edited by Alan Kilborn Feb 27, 2021, 1:45 PM Feb 27, 2021, 1:45 PM

            @Carolina-Number-1

            But, because you’re an admitted noob, why not do a simpler-to-understand Extended mode replacement, like this:

            58fdc235-dae6-4e51-beba-5e5351f3f61f-image.png

            Notice:

            • the Search mode has been set to Extended – this allows you to do fancy things (over and above what a Normal search allows) like specify multiple lines in your data (here you are replacing one-line with two (the original plus a new one).

            • the \r\n in the Replace with data is what creates a second line in your data; it is the “dividing point” between two lines

            Is this easier to see/understand?

            1 Reply Last reply Reply Quote 2
            • G
              guy038
              last edited by Feb 27, 2021, 1:45 PM

              Hi, @carolina-number-1

              eeb17561-1990-459b-a59d-9676327f3b76-image.png

              BR

              guy038

              C 2 Replies Last reply Feb 27, 2021, 1:48 PM Reply Quote 0
              • C
                Carolina Number 1 @guy038
                last edited by Feb 27, 2021, 1:48 PM

                @guy038

                Hey Thanks All!!!

                You are great!!!

                I am 70 and a tad slow but getting it, i think lol

                1 Reply Last reply Reply Quote 1
                • C
                  Carolina Number 1 @guy038
                  last edited by Feb 27, 2021, 2:54 PM

                  @guy038
                  t seems now its just stopped replacing…say no occurences were replaced …etc

                  Thank you,
                  Bob M.

                  1 Reply Last reply Reply Quote 0
                  • C
                    Carolina Number 1
                    last edited by Feb 27, 2021, 3:37 PM

                    If I need to change this: isuserselectable = 0 ; flag off for non selectable planes to this:

                    isUserSelectable = 0 ; (on the end of search line after 0 ; \R\K

                    and still replace with:

                    sound = “sound” ; sound folder (sound = “sound” ; sound folder\r\n)

                    1 Reply Last reply Reply Quote 0
                    • G
                      guy038
                      last edited by guy038 Feb 27, 2021, 6:01 PM Feb 27, 2021, 5:53 PM

                      @carolina-number-1,

                      Your last post isn’t quite clear but I guess you would like to add the line sound = "sound" ; sound folder right after each line beginning with isuserselectable = 0, whatever the contents of a possible comment area, coming next the colon character

                      If so, change the search regex, only, as :

                      SEARCH (?-si)isuserselectable = 0.*\R\K

                      • The (?-s) part means that any dot meta-character matches a single standard character

                      • The .* syntax, before the \R , represents the area, possibly empty, of standard character(s), after the string = 0 and before the EOL chars

                      I advice you to get documentation on the regex world, in this FAQ

                      Best regards,

                      guy038

                      C 1 Reply Last reply Feb 28, 2021, 1:39 PM Reply Quote 0
                      • C
                        Carolina Number 1 @guy038
                        last edited by Feb 28, 2021, 1:39 PM

                        @guy038

                        Hey Thank you…You are awesome…thanks for all your help!! Defeinitely check out the faq…

                        BobM.

                        C 1 Reply Last reply Feb 28, 2021, 1:51 PM Reply Quote 0
                        • C
                          Carolina Number 1 @Carolina Number 1
                          last edited by Feb 28, 2021, 1:51 PM

                          @guy038

                          Just curious and maybe it can’t be done… but lets say I have 100 Fltsims and I want to be apostrophe’s at the beginning and end of the title line only…can that be done…here’s a sample:

                          [fltsim.1]
                          title=“JFAI_737_300_AirChina”
                          sim=TrafficGlobal
                          model=
                          panel=x
                          sound=
                          texture=AirChina
                          atc_id=B737
                          atc_flight_number=
                          atc_airline=AIR CHINA
                          atc_parking_codes=CCA
                          atc_parking_types=GATE,RAMP
                          ui_manufacturer=Boeing
                          ui_type=B733
                          ui_variation=Air China
                          description=AI
                          ui_typerole=Traffic Global AI
                          ui_createdby=Just Flight

                          [fltsim.2]
                          title=“JFAI_737_300_AllNippon”
                          sim=TrafficGlobal
                          model=
                          panel=x
                          sound=
                          texture=AllNippon
                          atc_id=B737
                          atc_flight_number=
                          atc_airline=ALL NIPPON
                          atc_parking_codes=ANA
                          atc_parking_types=GATE,RAMP
                          ui_manufacturer=Boeing
                          ui_type=B733
                          ui_variation=All Nippon
                          description=AI
                          ui_typerole=Traffic Global AI
                          ui_createdby=Just Flight

                          So in other words…I would open the document in Notepad++ and want to put the apostrophe at the beginning and end of just the “Title line” for each fltsim section…1,2,3, etc… Might have to do a couple thousand of these…lol

                          i learned so much yesterday on the little I did that now I am dangerous!!!

                          BobM.

                          A 1 Reply Last reply Feb 28, 2021, 2:29 PM Reply Quote 0
                          • A
                            Alan Kilborn @Carolina Number 1
                            last edited by Alan Kilborn Feb 28, 2021, 2:29 PM Feb 28, 2021, 2:29 PM

                            @Carolina-Number-1 said in Paste every "say 37th line" apx..:

                            So, presuming you have:

                            title=JFAI_737_300_AirChina

                            and you want that to be changed into:

                            title="JFAI_737_300_AirChina"

                            and that is the only thing you have on the line…

                            Then you could do:

                            find: (?-s)^title=(.+)
                            repl: title="${1}"
                            mode: Regular expression

                            There are of course some other ways, but this is probably the simplest, and I don’t think it is really worth showing a total noob some of the other ways at this point, because the confusion factor would just skyrocket.

                            C 2 Replies Last reply Feb 28, 2021, 3:04 PM Reply Quote 1
                            • C
                              Carolina Number 1 @Alan Kilborn
                              last edited by Carolina Number 1 Feb 28, 2021, 3:06 PM Feb 28, 2021, 3:04 PM

                              @Alan-Kilborn

                              Hey Thanks!! Never been called a a total noob before… I am so honored…lol

                              Warmest Greets…Stay Safe!!

                              BobM.

                              1 Reply Last reply Reply Quote 0
                              • C
                                Carolina Number 1 @Alan Kilborn
                                last edited by Feb 28, 2021, 3:11 PM

                                @Alan-Kilborn worked like a charm…zowie :)

                                BobM.

                                1 Reply Last reply Reply Quote 0
                                • G
                                  guy038
                                  last edited by guy038 Feb 28, 2021, 3:15 PM Feb 28, 2021, 3:13 PM

                                  Hi, @carolina-number-1 and All,

                                  I guess that you want to surround any text after the string title = with two double-quotes "

                                  If so, this regex S/R is the right one :

                                  SEARCH (?-si)^(title\x20*=\x20*+)(?!")(.+)

                                  REPLACE \1"\2"

                                  As usual :

                                  • Tick the Wrap around option and select the Regular expression search mode

                                  • Click, either, several times on the Replace button or once only on the Replace All button

                                  Notes :

                                  • The part (?-si)^(title\x20*=\x20*) selects the string title, with that exact case ( (?-i) ), at beginning of line ( ^ ), followed with the equal sign ( = ), possibly preceded and/or followed with space char(s) ( \x20* ) and stores all in group 1

                                  • Remark that the \x20*+ regex range of space chars, after the equal sign, defines an atomic structure. This means that no backtracking will be done, by the regex engine, in that range of spaces. In other words, this means : "search for possible space chars, after the = sign, and verify, immediately that the next char is not a double-quote sign "

                                  • As said above, the part (?!") is a negative look-ahead structure. which tests, if, at current position, a " symbol can be found. If not, the condition is considered as TRUE and the current match attempt is OK, so far

                                  • Then, the part (.+) matches the remaining standard characters of current line and stores them as group 2

                                  • The replacement part \1"\2" rewrites these two groups, with two doubles quotes surrounding the group 2

                                  Remark that the (?!") regex part avoids to surround an area, already surrounded with double-quotes, which would give, for instance, ““some text””, in case you would click twice on the Replace All button

                                  @carolina-number-1, do not bother about atomic quantifiers and look-around structures, for the moment !, You have plenty of basic regex expressions to learn before ;-))

                                  Best Regards,

                                  guy038

                                  C 1 Reply Last reply Feb 28, 2021, 3:17 PM Reply Quote 0
                                  • C
                                    Carolina Number 1 @guy038
                                    last edited by Feb 28, 2021, 3:17 PM

                                    @guy038 Thank you!!

                                    BobM.

                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      Alan Kilborn
                                      last edited by Feb 28, 2021, 4:33 PM

                                      @Alan-Kilborn said in Paste every "say 37th line" apx..:

                                      I don’t think it is really worth showing a total noob some of the other ways at this point, because the confusion factor would just skyrocket.

                                      It appears that I was disagreed with on the above point.

                                      1 Reply Last reply Reply Quote 0
                                      • G
                                        guy038
                                        last edited by guy038 Feb 28, 2021, 4:47 PM Feb 28, 2021, 4:36 PM

                                        Hi, All,

                                        I’m going to explain the benefit of the atomic quantifiers, by adding the + symbol after the greedy quantifier !

                                        Let’s consider these four lines text below, with 2 without leading space chars and 2 with four leading space chars :

                                        abc
                                        "abc"
                                            abc
                                            "abc"
                                        

                                        And let’s suppose that we want to surround the string abc with double quotes, only in line 1 and 3

                                        You could say that the following search regex

                                        SEARCH ^(\x20*)(?!")(.+)

                                        Would match the line 1 and 3, only. However, it also matches the fourth line ! Why ?


                                        Well, a very important thing to remember, about regex engines, is that, regex engines try, by all means, to get an overall match. In other words, they, desperately, try to find a solution, by testing all the possible combinations, provided by the search regex !

                                        So, let’s imagine the regex engine at beginning of the line 4 of our sample :

                                        • Once the regex engine has consumed all the possible space chars ( ^(\x20*) ), it tests if the next char is not a " character. As it’s false, this means that the negative look-ahead return FALSE and no match can occur

                                        • The regex engine don’t give up and backtracks, considering all space chars, but the last, as matching the ^(\x20*) regex, too

                                        • Thus, the next char is the last space character, which does match the last .+ regex part and is not a double quote ! So, the (?!") part return TRUE and the overall regex can match the fourth line.

                                        • But we do not want this match as, after replacement, we would get "" ......."". So, in our regex, the solution is to use the atomic quantifier *+, instead of the greedy quantifier *. Indeed, when the regex engine meets an atomic quantifier, it will never backtrack inside the quantified area !

                                        SEARCH ^(\x20*+)(?!")(.+)

                                        • Thus, after matching all the space chars, it just tests if the next char is not a " character. As it’s false, this means that the negative look-ahead is FALSE. But, as the backtracking feature is forbidden, the regex engine stops and returns no match , for the fourth line contents

                                        As a summary, by preventing the regex engine from backtracking, the atomic quantifiers may reduce, drastically, the number of combinations, tested by the regex engine, and/or avoid testing some alternatives, particularly in recursive regexes.That leads to safer and quicker regexes’s execution !

                                        BR

                                        guy038

                                        A 1 Reply Last reply Feb 28, 2021, 4:52 PM Reply Quote 0
                                        • A
                                          Alan Kilborn @guy038
                                          last edited by Feb 28, 2021, 4:52 PM

                                          @guy038

                                          Ok, Guy is putting on a “clinic”, in this case for “All”.
                                          In that case, “Nice Job!”

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