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

Offline philetbabe

  • *
  • Posts: 497
  • Rep: 2
  • Drop D
    • View Profile
    • Awards
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]
"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;<text font fg_mcn14>You didn't win, but all participants receive a free six-pack of Fruity-Punch.</text>
&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;<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>
« Last Edit: September 24, 2009, 02:21:52 PM by philetbabe »

Offline ACAMS

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 »