Q:

vim find all _ except \sm_

What regex can I use in vim to find all underscores except those used in the following:
m_<some variable name>

A:

Assuming that <some variable name> can only consist of alphanumeric characters (but not _), we can do a negative lookbehind assertion (:help /\@<!) for \<m (i.e. a keyword must not start with m before the _)
/\%(\<m\)\@<!_/

Things get more complicated if <some variable name> can also contain underscores itself. We then have to exclude at the same position (:help /\@!) matches before the underscore (:help /\@<=) of \<m and \<m_\w* and \<m_\w*_\w* and so on, ending with \w*\>:
/\%(\%(\<m\%(_\w*\)*\)\@<=_\w*\>\)\@!_/

That will also exclude m_ itself. To fix that we need to differentiate (via two branches) between excluding underscore matches later in \<m_\w* and matches directly after \<m that then must have \w\+ to have it excluded:
/\%(\%(\<m\%(_\w*\)\+\)\@<=_\w*\>\|\%(\<m\)\@<=_\w\+\>\)\@!_/

