I have a sample data like this:
#10009
#10009
#10010
#10010
And I want to make it like:
#10009
#10009.
#10010
#10010.
Find & Replace, "Regular expression":
Find (.*\r\n.*)(\r\n)
, replace with \1.\2
(Assumes you have Windows line endings and the last line ends in a \r\n
)
Explanation:
.*
matches anything any number of times.\r\n
is Windows carriage-return line-feed end of line.(
and )
denote capture groups. These are what the \1
and \2
refer to in the replace string.You could also use macro recording to solve this. If you put your cursor before the first of the pairs (on line one), hit Start Recording, then hit "Down|End|.|Down|Home" and then Stop Recording. Then you can use Macro|Run a macro multiple times|Run until end of file.
The Regex solutions offered can be more powerful, but using a macro to solve simple problems can be easier to understand and faster for those not well versed in Regex.
#
was part of the original question. See the first edition source: superuser.com/revisions/a520e588-4a37-4ab9-9f9b-e03fcfc5ae31/…