I want to know a command for this:

a word start with 123 but NOT followed by 45, such as

12346
12357

are match,
only 12345 not match.


The regexp you're looking for would be something like

        \<123\(45\)[EMAIL PROTECTED]

That breaks down as

\<   the beginning of a word
123     the stuff you want that starts the word
\(45\)  the stuff you want to exclude
[EMAIL PROTECTED]       the exclusion
\w*     (optionally) the remainder of the word

You can read more at

        :help /[EMAIL PROTECTED]

which is subtly different from

        :help /\@<!

depending on one's needs.

The above can be used in any context you'd use a regexp...searching, :s or :g commands, or elsewhere.

-tim


Reply via email to