Community
    • Login

    How to suceed these actions in notepad++ (images included)

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    19 Posts 4 Posters 873 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.
    • guy038G
      guy038
      last edited by guy038

      Hello, @djspirosg and All,

      Note that, in my search regex, the \h+ syntax stands for any non-null number of consecutive horizontal blank characters, so a single tab char, instead of two space chars, would be OK, too !

      Strictly speaking, the \h syntax is identical to the class range character [\t\x20\xA0] and \H is identical to the negative class [^\t\x20\xa0]

      BR

      guy038

      1 Reply Last reply Reply Quote 2
      • DJSpirosGD
        DJSpirosG
        last edited by

        Have a nice day!

        I really appreciate the time you have spent to help me and solve my “problems”.

        Now that i found you i can’t resist on asking for some more help!!! :-)
        I tried the scripts from above but they didn’t work. I also tried to edit them a bit without luck (Noob here sorry)

        So the original text is (the first line is blank):

        
        1
        Tap In (Club Killers Hyphy Wordplay Segue Pack)
        Saweetie, E40, Keak Da Sneak, Mac Dre
        
            Tap In vs. Tell Me When To Go - Clean | Tap In vs. Tell Me When To Go - Dirty | Tap In vs. Feelin Myself - Clean | Tap In vs. Feelin Myself - Dirty | Tap In vs. Super Hyphy - Clean | Tap In vs. Super Hyphy - Dirty
            06/24/2020
            BPM: 100
            KEY: 1A
        
        2
        Shimmy Shimmy Shimmy Ya (Club Killers Wordplay Segue)
        Ol' Dirty Bastard, Lil Wayne, Doja Cat
        
            Clean - Piano In | Dirty - Piano In | Clean - Scratch In | Dirty - Scratch In
            06/10/2020
            BPM: 98
            KEY: 12A
        
        3
        Just A Lil Bit (Club Killers Blend)
        Scott Storch ft Ozuna & Tyga vs 50 Cent
        
            Intro - Clean | Intro - Dirty | Blend To OG - Clean | Blend To OG - Dirty
            05/29/2020
            BPM: 100
            KEY: 1A
        
        4
        

        Now i want to format it to:

        Tap In (Club Killers Hyphy Wordplay Segue Pack) - Saweetie, E40, Keak Da Sneak, Mac Dre
        Shimmy Shimmy Shimmy Ya (Club Killers Wordplay Segue) - Ol' Dirty Bastard, Lil Wayne, Doja Cat
        Just A Lil Bit (Club Killers Blend) - Scott Storch ft Ozuna & Tyga vs 50 Cent
        Back It Up (DJ Nasa VIP Rework) - Trap Beckham ft Flo Milli
        
        Alan KilbornA 1 Reply Last reply Reply Quote 0
        • Alan KilbornA
          Alan Kilborn @DJSpirosG
          last edited by

          @DJSpirosG said in How to suceed these actions in notepad++ (images included):

          Now that i found you i can’t resist on asking for some more help!!! :-)

          Yes, a common theme here.
          People just want to use this as a (FREE) data conversion service.
          They don’t want to actually learn anything.
          Don’t be one of those.
          Because you will get cut off.

          I tried the scripts from above but they didn’t work. I also tried to edit them a bit without luck

          To get further assistance, tell us what you tried and what was the result you obtained.
          Then you can probably get steered in the correct direction.
          But to just say it doesn’t work isn’t going to get you anything.

          DJSpirosGD 1 Reply Last reply Reply Quote 2
          • DJSpirosGD
            DJSpirosG @Alan Kilborn
            last edited by

            @Alan-Kilborn

            Hi @Alan-Kilborn sorry but i’m not used to how regex works, especially when it’s complicated.
            I’m trying to understand some of the scripts but i don’t really have the basic knowledge to succeed that most of the times.
            I Tried to change the values (first 2 numbers and the last one) on the replace with ?2\1\x20-\x20\4 cell to see if i will succeed what i want to but i didn’t find a working script. as i told you am not familiar with regex language (i wish to).

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

              Hello, @djspirosg, @Terry-r, @alan-kilborn and All,

              So, assuming this piece of data :

              1
              Tap In (Club Killers Hyphy Wordplay Segue Pack)
              Saweetie, E40, Keak Da Sneak, Mac Dre
              
                  Tap In vs. Tell Me When To Go - Clean | Tap In vs. Tell Me When To Go - Dirty | Tap In vs. Feelin Myself - Clean | Tap In vs. Feelin Myself - Dirty | Tap In vs. Super Hyphy - Clean | Tap In vs. Super Hyphy - Dirty
                  06/24/2020
                  BPM: 100
                  KEY: 1A
              
              2
              Shimmy Shimmy Shimmy Ya (Club Killers Wordplay Segue)
              Ol' Dirty Bastard, Lil Wayne, Doja Cat
              
                  Clean - Piano In | Dirty - Piano In | Clean - Scratch In | Dirty - Scratch In
                  06/10/2020
                  BPM: 98
                  KEY: 12A
              
              3
              Just A Lil Bit (Club Killers Blend)
              Scott Storch ft Ozuna & Tyga vs 50 Cent
              
                  Intro - Clean | Intro - Dirty | Blend To OG - Clean | Blend To OG - Dirty
                  05/29/2020
                  BPM: 100
                  KEY: 1A
              

              The following regex S/R :

              SEARCH (?-s)^(?![\h\d])(.+)\R(?![\h\d])(.+)|^.*\R

              REPLACE ?1\1\x20-\x20\2

              would return the expected text, below :

              Tap In (Club Killers Hyphy Wordplay Segue Pack) - Saweetie, E40, Keak Da Sneak, Mac Dre
              Shimmy Shimmy Shimmy Ya (Club Killers Wordplay Segue) - Ol' Dirty Bastard, Lil Wayne, Doja Cat
              Just A Lil Bit (Club Killers Blend) - Scott Storch ft Ozuna & Tyga vs 50 Cent
              

              Notes :

              • As usual, the (?-s) in-line modifier ensures that the regex dot symbol represents a single standard character and not a line-break character

              • Then, the (?![\h\d]) is a negative look-ahead structure which tells the regex engine that a blanck or a digit character is not supposed to be at beginning of lines searched

              • Now, the part .+\R matches all the contents of current line with its line-break char(s)

              • Again, the part (?![\h\d])(.+) looks for all contents of a line, without the line-break chars,not beginning with, either, a digit or a blank character

              • If current scanned line does not respect the previous condition, all its contents with its line-break chars, including true empty lines, are matched with the ^.*\R pattern, located after the alternation symbol |

              • In replacement, the syntax (?#.....), or ?#....., is a conditional replacement which means :

                • If group 1 exists (.+), then groups 1 and 2 must be rewritten, separated with a space, a dash and a space again , so the regex \1\x20-\x20\2

                • If the second alternative matches, group 1 does not exist, so all these other lines are simply deleted


              For a quick overview of regular expressions, begin here :

              https://www.regular-expressions.info/quickstart.html

              You’ll find additional information here

              Best Regards,

              guy038

              DJSpirosGD 2 Replies Last reply Reply Quote 2
              • DJSpirosGD
                DJSpirosG @guy038
                last edited by

                @guy038 Hi, I have no words mate, thanks for the time you are spending to help me and also teach me/explain me the logic of regex.

                The explanation is really useful to help me understand how it actually works!!!

                I’ll start reading it ASAP.

                Once again, thank you!

                1 Reply Last reply Reply Quote 0
                • DJSpirosGD
                  DJSpirosG @guy038
                  last edited by

                  @guy038 said in How to suceed these actions in notepad++ (images included):

                  Then, the (?![\h\d]) is a negative look-ahead structure which tells the regex engine that a blanck or a digit character is not supposed to be at beginning of lines searched

                  @guy038 What if the song or the artist name starts with a digit though?

                  ex.

                  8
                  Trollz (DJ Nasa Vip Edit)
                  6ix9ine ft Nicki Minaj vs Lil Jon
                  
                      Intro - Clean | Intro - Dirty | Slam In - Clean | Slam In - Dirty | Acap In - Clean | Acap In - Dirty
                      06/18/2020
                      BPM: 95
                      KEY: 12A
                  
                  9
                  
                  1 Reply Last reply Reply Quote 0
                  • DJSpirosGD
                    DJSpirosG
                    last edited by

                    @guy038 I think i found how to Solve the problem with a song or an artist starting with a digit!

                    SEARCH (?-s)^(?![\h\d])(.+)\R(?![\h])(.+)|^.*\R

                    REPLACE ?1\1\x20-\x20\2

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

                      Hi, @djspirosg and All,

                      Ah…OK. In that case, we’re going to change the condition inside the look-ahead !

                      The lines which must be joined with a dash ``-` symbol must NOT begin with, either :

                      • An horizontal blank character ( then, this covers the case several blank chars, too ! )

                      • One or several digit char(s), immediately followed with line-break char(s)

                      So, the negative look-ahead becomes (?!\h|\d+\R)

                      This new syntax allows, both, the song and the artist name to begins with one or several digits

                      So, assuming this text :

                      1
                      1Tap In (Club Killers Hyphy Wordplay Segue Pack)
                      12345Saweetie, E40, Keak Da Sneak, Mac Dre
                      
                          Tap In vs. Tell Me When To Go - Clean | Tap In vs. Tell Me When To Go - Dirty | Tap In vs. Feelin Myself - Clean | Tap In vs. Feelin Myself - Dirty | Tap In vs. Super Hyphy - Clean | Tap In vs. Super Hyphy - Dirty
                          06/24/2020
                          BPM: 100
                          KEY: 1A
                      
                      2
                      22Shimmy Shimmy Shimmy Ya (Club Killers Wordplay Segue)
                      000Ol' Dirty Bastard, Lil Wayne, Doja Cat
                      
                          Clean - Piano In | Dirty - Piano In | Clean - Scratch In | Dirty - Scratch In
                          06/10/2020
                          BPM: 98
                          KEY: 12A
                      
                      3
                      33333Just A Lil Bit (Club Killers Blend)
                      3Scott Storch ft Ozuna & Tyga vs 50 Cent
                      
                          Intro - Clean | Intro - Dirty | Blend To OG - Clean | Blend To OG - Dirty
                          05/29/2020
                          BPM: 100
                          KEY: 1A
                      

                      With that regex S/R :

                      SEARCH (?-s)^(?!\h|\d+\R)(.+)\R(?!\h|\d+\R)(.+)|^.*\R

                      REPLACE ?1\1\x20-\x20\2

                      you’ll get this result, where all the artist’s names and song’s name begin with a number !

                      1Tap In (Club Killers Hyphy Wordplay Segue Pack) - 12345Saweetie, E40, Keak Da Sneak, Mac Dre
                      22Shimmy Shimmy Shimmy Ya (Club Killers Wordplay Segue) - 000Ol' Dirty Bastard, Lil Wayne, Doja Cat
                      33333Just A Lil Bit (Club Killers Blend) - 3Scott Storch ft Ozuna & Tyga vs 50 Cent
                      

                      Thanks for searching on your own ! Your regex is OK if the second line begins with a digit but would not work if the first line would begin with a digit !

                      BR

                      guy038

                      DJSpirosGD 1 Reply Last reply Reply Quote 2
                      • DJSpirosGD
                        DJSpirosG @guy038
                        last edited by DJSpirosG

                        @guy038 said in How to suceed these actions in notepad++ (images included):

                        Thanks for searching on your own ! Your regex is OK if the second line begins with a digit but would not work if the first line would begin with a digit

                        I’am trying to learn! Not successfully i guess :-P

                        You are right i haven’t thought about the first line, i was focusing on artist because of my example. I don’t say that i could solve it though :-)

                        By the way your script works flawlessly

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