Adding " at the beginning and end of every line
-
I was given the following info and it worked until yesterday but does not work today. This is VERY strange. Instead of adding just a double quote at the beginning or end, it replaces the first or last character with the & symbol.
For example, you can add a quote at the end of every line:
Edit > Find & Replace
Search for: .$
Replace with: &"Options/Regular expressions: ON
Click Replace All
And, similarly, at the beginning:
Search for: ^.
Replace with: "&I have restarted the program and reloaded the document with no success. What is wrong now? I have tried it over and over again and get the same result.
Thanks.
-
I think you need to write
$&"
and"$&
for replacement. You may want to use[^"]
instead of.
to skip lines already beginning/ending with"
. Use[^"\r\n]
to also skip empty lines. -
Hello @W-C
when having
Search for: $ Replace with: "
and
Search for: ^ Replace with: "
then it should have worked but not with the dot char added and with the restriction gerdb42 mentioned.
You can also use a single regex, something like
Search for: ^(.+)$ Replace with: "\1"
Search for explained:
^ = from the beginning of the line
(.+) = looking for atleast one but as much as possible chars and return the match until
$ = end of line is reachedReplace with explained:
" = insert a double quote followed by the
\1 = matched result and
" = add an additional double quoteCheers
Claudia