I want to use regex to match the following strings:
blub{
(no intervening space) and blub {
(two intervening spaces) and blub {
(three intervening spaces) and so on but not blub {
(one intervening space)
In the moment I can match blub{
with /\S{/
and the rest with /\S \{2,}{/
in my vimrc file.
However I cannot combine these to regex expressions in vim. How can I achieve this?
The aim is to mark in my cpp files all lines where the bracket has not a space between.
A regular expression followed by an asterisk ( * ) matches zero or more occurrences of the regular expression. If there is any choice, the first matching string in a line is used.
+: one or more ( 1+ ), e.g., [0-9]+ matches one or more digits such as '123' , '000' . *: zero or more ( 0+ ), e.g., [0-9]* matches zero or more digits. It accepts all those in [0-9]+ plus the empty string.
The RegExp \s Metacharacter in JavaScript is used to find the whitespace characters. The whitespace character can be a space/tab/new line/vertical character. It is same as [ \t\n\r].
[^ ] matches anything but a space character.
Use alternatives.
/\S\(\| \{2,}\){/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With