Regular expression explanation for vim

前端 未结 3 1505
旧时难觅i
旧时难觅i 2021-02-09 15:58

If I want all the lines with the text \'ruby\' but not \'myruby\' then this is what I would do.

:g/\\/

My question is what is the

3条回答
  •  情歌与酒
    2021-02-09 16:36

    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.

提交回复
热议问题