Totorial 3: simple Regular expression (regex) find replace in notepad++



Let's suppose I have 100s of lines similar to this 
{ id: 'First Ack.', type: 'float'},
{ id: 'Packets In', type: 'int'},

and I want to convert these lines in some format like :

{ id:'Packets In',field:'Packets In',type 'int'},
{ id:'First Ack.',field:'First Ack.',type 'float'}

To this in  notepad++ (also in most editors) search for
id: (.*), type:
and
replace with
id:\1,field:\1,type

and press replace all
and you are done no matter how many rows.

Comments

Popular posts from this blog

College Prompt

Type of Common Charts used in visualization

The Futility of Being Remembered: A Reflection on Life's True Purpose