Skip to main content

Questions tagged [regular-expression]

Regular expressions (often shortened to "regex") are expressions written in a declarative language used for matching patterns within strings.

15 votes
3 answers
2k views

When I want to replace the two lines %argdel edit wezterm.lua with these: 0argadd wezterm.lua last The only regex that seems to work is this: %s/\V%argdel\nedit \(wezterm.lua\)/0argadd \1\rlast/g ...
glades's user avatar
  • 187
0 votes
1 answer
40 views

By :h bufname, there are three different meanings when the return value is an empty string: [...] set and 'cpoptions' is empty. **When there is more than one match an empty ...
N.W.'s user avatar
  • 1,860
0 votes
1 answer
115 views

The goal is to highlight text inside [...] with a different color than text inside ![...]! Also everything should be nestable such that [...] could contain ![...]! inside of it or vice versa and the ...
yousefx0's user avatar
1 vote
3 answers
147 views

The following hangs on the 2nd ex call: echo foo > test.txt ex -s -c '%s/foo/bar/|x' test.txt ex -s -c '%s/baz/foo/|x' test.txt The reason it hangs is, there is no baz in test.txt. It hangs so ...
Martin Braun's user avatar
2 votes
3 answers
132 views

When I start developing some lib, I usually start from functions implementation and then I proceed to the header file. So, after copying the .c source file to .h, thus having the header file as: void ...
simzz's user avatar
  • 580
1 vote
1 answer
115 views

If I want to capture x, then the regex shall be able to capture exactly x and not xx or xxx, or if I want to capture xx, then then the regex shall be able to capture exactly xx and not xxxx or xxxxxx. ...
Barzi2001's user avatar
  • 1,133
0 votes
2 answers
340 views

How to remove all HTML or XML tags from a file with Vim regex? :%s/<.*>//g is greedy and will match everything between the first < and the last > on the line.
cassepipe's user avatar
  • 537
0 votes
1 answer
81 views

I am trying to create my own color scheme in the latest version of gVim and I have encountered a problem. When I try to add a new group for syntax highlighting, for example I want the library ...
Egor's user avatar
  • 1
1 vote
1 answer
94 views

I use Vim with marker folding for my work and the presence of all the fold markers annoys my colleagues, so I want a quick and easy way to cleanly remove them all from my files. Closing markers are ...
David Shaw's user avatar
1 vote
1 answer
30 views

I have some javascript files with hard coded base64 strings, and there is horrible lag between cursor commands. When I did a syntime report, I am seeing: 3.553307000 589 38 0.196905000 0....
patrick's user avatar
  • 113
0 votes
1 answer
51 views

Currently I'm using: \v(((^|,)[^,]*){3})(.*) to match csv lines, the first part ((^|,)[^,]*){3} is to match 3 items, then the second part .* matches the rest. However, if the csv line starts with a ...
athos's user avatar
  • 359
1 vote
1 answer
460 views

I have the following line in my file: if (Infix[i] == '+' || Infix[i] == '-' || Infix[i] == '/' || Infix[i] == '*') When I search using the command /Infix[i] I am getting the error: E486: Pattern not ...
Noyal Martin's user avatar
2 votes
1 answer
164 views

I'm trying to swap the arguments to function GetNumberOfMilliSeconds() using a regular expression. Currently I'm doing it by using macros and copying the first and second parameters into different ...
DailyLearner's user avatar
1 vote
2 answers
48 views

As Vivian answered in , using \v(^|,)\zs([^,"]*|("[^"]*")|(""".{-}"""))\ze(,|$) can match csv items such as: simple e.g.: ,abc,, whose content is ...
athos's user avatar
  • 359
0 votes
2 answers
58 views

During :s command line substitute, after matching I can use abc\2,cde\1 this kind of syntax to format the output, however, seems it's not possible to use abc\2[3:-1],cde\1[2:3] to take a substring ...
athos's user avatar
  • 359

15 30 50 per page
1
2 3 4 5
40