Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to add (' to the front of every line.

I tried

Find what: ^
Replace with: ('

and bracket did not show up.

How can I add it to the beginning of each line?

share|improve this question

I am trying to add (' to the front of every line

( is a special character, you need to escape it with \

  • Menu "Search" > "Replace" (or Ctrl + H)

  • Set "Find what" to ^

  • Set "Replace with" to \('

  • Enable "Regular expression"

  • Click "Replace All"

    Image

Before:

Lorem ipsum dolor sit amet adipiscing ultricies varius egestas.
Lorem ipsum dolor sit amet adipiscing ultricies varius egestas.
Lorem ipsum dolor sit amet adipiscing ultricies varius egestas.
Lorem ipsum dolor sit amet adipiscing ultricies varius egestas.

After:

('Lorem ipsum dolor sit amet adipiscing ultricies varius egestas.
('Lorem ipsum dolor sit amet adipiscing ultricies varius egestas.
('Lorem ipsum dolor sit amet adipiscing ultricies varius egestas.
('Lorem ipsum dolor sit amet adipiscing ultricies varius egestas.

Further reading

share|improve this answer
3  
Regular expressions: the cause of and solution to all of programming's problems. +1 – MonkeyZeus Jan 8 at 20:35
    
@MonkeyZeus Agreed. I get lots of rep answering Notepad++ reg exp questions ;) – DavidPostill Jan 8 at 20:36

An alternative to using Find/Replace could be to use a Macro:

  1. Record a macro of you hitting Home twice, inserting your characters and then moving your cursor down to the next line (with your down arrow key).
  2. Run that macro "until the end of file".

enter image description here

Example of how to use macros in Notepad++:

enter image description here

Animation source/more info

share|improve this answer
    
Hmm. Adding (' to the start of every line is not the same as joining all the lines up and separating them with ',', with no ( anywhere after you are finished. Are you answering some other question? – DavidPostill Jan 8 at 16:26
    
@DavidPostill The "example usage" animation is to show how to use macros in Notepad++, not how to solve this exact issue (that's what the rest of the answer is for). I made a couple changes to help clarify. ;) – Ƭᴇcʜιᴇ007 Jan 8 at 16:35

Just informational (RegEx replace is the best in this situation)...

There is Column Mode Editing in Notepad++, so you can:

  • Go to file begin Ctrl+Home.
  • Mark to file end Ctrl+Shift+End.
  • Mark to line begin in column modeShift+Alt+Home.
  • Type ('.

Column Mode is more useful with Column Editor when you are inserting numbers.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .