in Education by
This question already has answers here: Find and replace strings in vim on multiple lines (11 answers) Vim - Capture strings on Search and use on Replace (4 answers) Closed 3 years ago. I am editing a markdown file with vim. This file exist many string \norm{ some string }. I want to replace them by \| some string \|. Does there exist any quick way? Thanks very much. The answer in Find and replace strings in vim on multiple lines can not answer my question. It just talk about general replacing for one line and multi line. Here I want to replace a surrounding and keep the string in the surrounding. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
What you're looking for are so-called capture groups and backreferences. Provided there are no nested forms (curly braces inside do not mean a problem in themselves) and forms spanning multiple lines, a quick solution could be: %s/\\norm {\(.*\)}/\\|\1\\|/g. The \1 in the substitution part refers to the group captured by \(.*\), i.e. the original content inside the outermost pair of curly braces. See e.g. http://www.vimregex.com/#backreferences for more.

Related questions

0 votes
    Currently I try to switch from vim to emacs and have some difficulty while editing code. For most of ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I would prefer to write my commit messages in Vim, but it is opening them in Emacs. How do I configure Git ... for a single project. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    ______________ allows the algorithm to execute more quickly by performing CPU activity in parallel with I/O ... topic in division Query Processing Techniques of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    What is defined as the ability to compete and thrive in the digital age by quickly responding to market changes and emerging opportunities with innovative business solutions?...
asked Nov 28, 2020 in Technology by JackTerrance
0 votes
    Which distribution looks like a norm distribution but with very heavy tails? (a) Simple (b) Discrete (c) ... Networks of R Programming Select the correct answer from above options...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    How can i replace a string that contain symbol to a class css? HTML JQUERY p= '@.class-two'; $( ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    Today I found out that putting strings in a resource file will cause them to be treated as literals, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Today I found out that putting strings in a resource file will cause them to be treated as literals, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Today I found out that putting strings in a resource file will cause them to be treated as literals, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Echo $var gives me something like http://342.234.243.142/data/somethingmore/ IP-address everytime is ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 28, 2022 in Education by JackTerrance
0 votes
    what does public String replaceAll(string replace) do? (a) Replace all characters that matches pattern with a ... Expressions of Java Select the correct answer from above options...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    what does public String replaceAll(string replace) do? (a) Replace all characters that matches pattern with ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    This question already has answers here: How to concatenate a std::string and an int (24 answers) Closed 5 years ago. int i = 4; string text = "Player "; cout...
asked Mar 24, 2022 in Education by JackTerrance
0 votes
    Std 9th The first generation computers used to shutdown because of ___________ . please answer quickly Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    A firefighter has to get to a burning building as quickly as he can. There are three paths that he can take. ... way should he choose? Select the correct answer from above options...
asked Nov 12, 2021 in Education by JackTerrance
...