vim how to replace backslash and & -
i using vim , want replace
&\\ \hline \\ \hline can teach me how this? %s/\&\\/\\/gc didn't work. latex table.
inside search pattern, don't need escape & (\& special atom branches), \ needs doubled. in replacement part, & have escaped, \ (yes, bit complex, unfortunately). so, work:
:%s/&\\\\/\\\\/gc if want assert following \hline, too, it's simpler end matching \ze (but still assert following part there); avoids having duplicate part should kept (or alternatively capture , re-insert in replacement):
:%s/&\ze\\\\ \\hline//gc
Comments
Post a Comment