Vim regular expression to match string with prefix and suffix

The command below should work unless “any character” means something different for you than for Vim:

:g/abc.*xyz
  • . means “any character except an EOL”.
  • * means “any number (including 0) of the previous atom”.
  • 1,$ could be shortened to %.
  • :global works on the whole buffer by default so you don’t even need the %.
  • The closing / is not needed if you don’t follow :g/pattern by a command as in :g/foo/d.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)