Regular expression explanation for vim

regex, vim

Solution

the `\<` and `\>` mean word boundaries. In Perl, grep and less (to name 3 OTOH) you use `\b` for this, so I imagine it's the same in Ruby.

Regarding your 2nd question, the escape is needed for the whole expression `{3}`. You're not escaping each curly brace, but rather the whole thing together.

See this question for more.

Problem

If I want all the lines with the text 'ruby' but not 'myruby' then this is what I would do. ``` :g/\<ruby\>/ ``` My question is what is the meaning of lesser than and greater than symbol here? The only regular expression I have used is while programming in ruby. Similarly if I want to find three consecutive blank lines then this is what I would do ``` /^\n\{3} ``` My question is why I am escaping the first curly brace ( opening curly brace ) but not escaping the second curly brace ( closing curly brace )?

Original source

Related problems