2006/10/23

Search pattern in VIM

The search pattern of VIM is little different with Perl. There is one thing I igonred at the beginning, and it made me confused for a long time. That is the group pattern can't be used inside the "[]"

In http://vimdoc.sourceforge.net/htmldoc/usr_27.html#27.6
 item matches   equivalent 
\d digit [0-9]
\D non-digit [^0-9]
\x hex digit [0-9a-fA-F]
\X non-hex digit [^0-9a-fA-F]
\s white space [ ] ( and )
\S non-white characters [^ ] (not and )
\l lowercase alpha [a-z]
\L non-lowercase alpha [^a-z]
\u uppercase alpha [A-Z]
\U non-uppercase alpha [^A-Z]
Using this predefined ranges works a lot faster than the character range it stands for.
But they can't be used inside the "[]" .

:-)
发表评论