Community
    • Login

    question

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 1.3k 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.
    • UpayU
      Upay
      last edited by

      hi guys i have a question

      i have paragraph

      bla blabla {suka|tidak|menyapa} blablbalba
      blablablaba {melihat|dilihat} blablabla
      blablablab {teriak|ditempeleng|jualan|murah} blablabla
      blablabla {ketek|joker|koper|nakal} blablaba

      what i want is the last word

      bla blabla menyapa blablbalba
      blablablaba dilihat blablabla
      blablablab murah blablabla
      blablabla nakal blablaba

      i hope u understand ,thank you very much

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

        Hi, @upay an All,

        Easy with regular exrpressions !

        • Open the Replace dialog ( Ctrl + H )

        • SEARCH (?-s)\{.+\||\}

        • REPLACE Leave EMPTY

        • Tick the Wrap aorund option, if necesaary

        • Clik on the Replace All

        Notes :

        • I assume that your text contains only one range {...|....|....}, per line

        • The search regex looks for two patterns, separated with the | alternation symbol

        • The { and } braces, as well as the | symbol, are special characters in regex syntax, so it must be escaped with \ to be seen as literal chars

        • The (?-s) part, forces the regex engine to see the regex char . as matching a single standard char ( not EOL ! )

        • Then the part \{.+\| looks for an opening brace { till the last | symbol, of each line

        • The second pattern is simply \} which matches an ending brace char

        • As replacement zone is empty, these two patterns are deleted

        Best Regards,

        guy038

        UpayU 1 Reply Last reply Reply Quote 2
        • UpayU
          Upay @guy038
          last edited by

          @guy038 it works , thanks…but i forget to explain more…
          actually i cant speak english i hope u understand :(

          for example

          Belajar {dari|berasal dari} {kesalahan|kekeliruan} musim sebelumnya, RRQ {terhadap|pada|dilakukan} MPL Season 2 seakan tak terbendung oleh tim lain. Dia {cuma|sanggup} melihat {dari jauh|apaya}.

          what i want is the last word, but other words not be deleted
          if not understand,what i want is the paragraph will be like this

          Belajar berasal dari kekeliruan musim sebelumnya, RRQ dilakukan MPL Season 2 seakan tak terbendung oleh tim lain. Dia sanggup melihat apaya.

          thank you very much i really appreaciate,

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

            Hi, @upay an All,

            Ah, OK ! Then, assuming that your text do not contain ranges {.............}, split on two lines as, for intance :

            {terhadap|pada|
            dilakukan}
            

            A possible solution would be :

            SEARCH (?-s)\{.+?\|([^|]+)\}

            REPLACE \1


            If we use the free-spacing mode, the regex, with some explanations in comments, can be rewritten as :

            (?x-s)     #  Search in FREE-SPACING ( SPACE char NO SIGNIFICANT ) and NO SINLE LINE modes ( DOT = a SINGLE STANDARD character )
              \{       #  An OPENING brace
              .+?      #  The SHORTEST NON-NULL range of STANDARD chars...
              \|       #  ...Till an ALTERNATION symbol
              (        #  Beginning of GROUP 1
                [^|]+  #    GREATEST NON-NULL range of characters, ALL DIFFERENT from an ALTERNATION symbol...
              )        #  End of GROUP 1
              \}       #  ...Till an ENDING brace
                       #  In replacement, \1 stands for the contents of GROUP 1
            

            Best Regards,

            guy038

            astrosofistaA UpayU 2 Replies Last reply Reply Quote 4
            • astrosofistaA
              astrosofista @guy038
              last edited by

              Hi @guy038, @Upay, All

              An alternative and graphical approach to @guy038’s efficient regex solution. The approach needs @Ekopalypse Python script, posted here and, of course, the Python plugin installed:

              giphy

              Words were marked by a regex expression just for visual reasons.

              Have fun!

              1 Reply Last reply Reply Quote 2
              • UpayU
                Upay @guy038
                last edited by

                @guy038 it works, like what i want… thank you very muchh :) :)

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