Home > Net >  How to add double quotes to first 2 elements of every line inside notepad plus plus?
How to add double quotes to first 2 elements of every line inside notepad plus plus?

Time:10-15

Current File sample in notebook plus plus-

1,1,"Establishes ",5
2,2,"Establishes",1
3,3,"Establishes",4
4,4,"Establishes",2
5,5,"Establishes",1

Desired Result-

"1","1","Establishes ",5
"2","2","Establishes",1
"3","3","Establishes",4
"4","4","Establishes",2
"5","5","Establishes",1

CodePudding user response:

Search pattern:

([^,] ),([^,] ),([^,] ),([^\n] )

Replace pattern:

"$1", "$2", $3, $4

To learn how to make a regex replacement in notepad , you can look at the:
enter image description here

  • Hold ALT SHIFT down, scroll the document to the end, use the mouse to place the cursor in the last row just to the left of the second element, and release the ALT SHIFT keys. You'll see a vertical line showing that you've selected the entire column. enter image description here
  • Enter CTRL V to paste the double quote character you copied ... and voila! enter image description here
  • Repeat step 3 for the right hand side of the second element and then for the left and right hand side of the first element.
  • This assumes all the columns of text line up. You can't, for example, do this across rows that have double digit values in the first or second element.

    In the ongoing effort to wrangle text, perhaps this will give you another tool to use.

    • Related