1

I'm having trouble formulating how to append the following to the beginning and end of the line in notepad++ :

Beginning ('

End ,10)

I tried using the following, but none would even match the beginning of the line:

%s/.*/"&"

^

When I used ^ this matched the beginning of line but if I tried to appending ^( it would just replace the line with ^ .

My sample data looks like:

/.../.../.../.../.../
\…..\\\…..\\\…..\\\
%00../../../../../../etc/file
%00/etc/file%00

Thanks

Jshee
  • 2,620
  • 6
  • 44
  • 60

3 Answers3

6

To match the beginning of line, use ^ anchor. Since ( is part of regex, it needs to be escaped:

Replace Front

Same goes for matching end-of-line: use $ and ,10\):

Replace Back

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
1

Use this:

^(.*)$

to capture everything.

Then replace with \('\1,10\),

where \(' is the beginning part, ,10\) is the end, and \1 is what you capture.

CinCout
  • 9,486
  • 12
  • 49
  • 67
0

Search for ^.*$, replace by ('$0,10).

$0 is a back-reference referencing the full match, ^ and $ are anchors that respectively match the start of the string and its end in the search pattern (they have no meaning in a replacement pattern, in which they are understood as the literal characters).

Aaron
  • 24,009
  • 2
  • 33
  • 57