Remove the text contained in quotes with notepad



  • 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



  • 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



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


Log in to reply