Community
    • Login

    Remove the text contained in quotes with notepad

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.1k 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.
    • AndrewJorA
      AndrewJor
      last edited by AndrewJor

      Greetings to all friends, I hope you can help me, I have a text (25908 lines) with quotation marks, please see the example:

      = “create” + “tablespace” + “ts1” + “datafile”

      I need to modify it to the next text

      = “database” + “tablespace” + “ts1” + “datafile”
      = “create” + “database” + “ts1” + “datafile”
      = “create” + “tablespace” + “database” + “datafile”
      = “create” + “tablespace” + “ts1” + “database”

      You are the teachers, I hope you help me
      Thank you

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

        Hello @andrewjor and All,

        If I’m textually understand your example, your have a text, with 5 words :

        = "create" + "tablespace" + "ts1" + "datafile"   “database”
             1            2           3         4            5 
        

        And you would like to transform the unique line :

        1 + 2 + 3 + 4
        

        into the four lines text, below, with the word 5, shifted, in each line, wouldn’t you ?

        = 5 + 2 + 3 + 4
        = 1 + 5 + 3 + 4
        = 1 + 2 + 5 + 4
        = 1 + 2 + 3 + 5
        

        Indeed, t’s easy to notice that you expect :

        • Word 5 to be the first word in line 1, instead of word 1
        • Word 5 to be the second word in line 2, instead of word 2
        • Word 5 to be the third word in line 3, instead of word 3
        • Word 5 to be the last word in line 4, instead of word 4

        BTW, I suppose that the double quote, surrounding the different words of your text, are the classical one " ( of code \x{0022} ) and not the “ and ” quotes ( with code \x{201c} et \x{201d} )

        In that case, and considering the sample text, below, with your 4 words followed with a fifth one, which is to be added in each line :

        = "create" + "tablespace" + "ts1" + "datafile"   “database”
        

        SEARCH (?-s)(".+?").+(".+?").+(".+?").+(".+?").+(".+?")

        REPLACE \5 + \2 + \3 + \4\r\n= \1 + \5 + \3 + \4\r\n= \1 + \2 + \5 + \4\r\n= \1 + \2 + \3 + \5

        It would be replaced as below :

        = "database" + "tablespace" + "ts1" + "datafile"
        = "create" + "database" + "ts1" + "datafile"
        = "create" + "tablespace" + "database" + "datafile"
        = "create" + "tablespace" + "ts1" + "database"
        

        Of course, it’s my first attempt which will, probably, need adjustments :-))

        Cheers,

        guy038

        AndrewJorA 1 Reply Last reply Reply Quote 1
        • AndrewJorA
          AndrewJor @guy038
          last edited by

          @guy038
          Mister guy038, my sincere thanks for your help, the code helped me a lot, went out to perfection

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