Author Topic: NotePad++ tips  (Read 1484 times)

Offline philetbabe

  • *
  • Posts: 510
  • Reputation: 2
  • Drop D
    • View Profile
NotePad++ tips
« on: September 24, 2009, 03:25:04 AM »
Question : how to add something in the beginning of each  line of a file.
Answer : Use search and Replace and Regular Expression.

For instance, imagine you're named ACAMS and you need to add " to the front of each line

here are the regular expressions to use  (GUI is Frnech, regular expression is international ):
search  : ^(.*)$ : which mean all the line
replace : "\1  : which mean the line prefixed by "

be aware to check 'regular expression'



result if applied to a file event.txt :
Code: [Select]
"0
"F.O.R.C.E. Tournament
&quot;<text font fg_mcn14>The bot association, Friends of Robotic Combat Events, began this tournament as a refuge for young robot builders scolded by critics of violent pastimes.</text>
&quot;4
&quot;Arenas\event_results\prizes\Fruit_Punch\Fruit_Punch.gmf
&quot;<text font fg_mcn14>You didn't win, but all participants receive a free six-pack of Fruity-Punch.</text>
&quot;Arenas\event_results\prizes\Vacation_Photo\vacation_photo.gmf
&quot;<text font fg_mcn14>At least you won the first round. You won an autographed photo of the beautiful supermodel, Glenda Goodsmile.</text>
&quot;Arenas\event_results\prizes\VCR_Series\VCR_Series2.gmf
&quot;<text font fg_mcn14>Hey, pretty good. You won two rounds! You won the video casette series, 'How to Build a Robot in Metal Shop Class Without the Teacher Finding Out.'</text>
&quot;Arenas\ev
...
« Last Edit: September 24, 2009, 02:21:52 PM by philetbabe »

Offline ACAMS

  • *
  • Posts: 3314
  • Reputation: -501
    • View Profile
    • myfolderz.com
NotePad++ tips
« Reply #1 on: November 11, 2009, 03:36:01 PM »
And to add text to the end of the line you simply put the text after \1
 
Here are the regular expressions to use
 
search: ^(.*)$ (which mean all the line is selected)
replace with: \1Text goes here (put any text or link)
 
Be sure to check 'regular expression'
 
You may have to trim trailing blank spaces, or you will get a space between the last word and your text, unless you want a space.
 
 
« Last Edit: November 11, 2009, 06:19:00 PM by ACAMS »