Searching for simple variable names like 'c' or 'x' in Emacs.

Posted by wpeters on Stack Overflow See other posts from Stack Overflow or by wpeters
Published on 2010-03-24T16:58:07Z Indexed on 2010/03/24 17:03 UTC
Read the original article Hit count: 195

Filed under:
|

I often wish to search for variables that are simply called 'c' or 'count'.

For example

int c, count;

Unfortunately when I use an incremental search for 'c' or 'count' I get a lot of unnecessary hits like the 'c' in 'choice', or the 'count' in 'wordcount' which do not interest me. I know Emacs can do i-searches with regular expressions but I don't know the correct regular expression needed to match just 'c' and 'count'. These words are often surrounded by any number of white spaces. Anyone know the regex I can use to narrow my search?

© Stack Overflow or respective owner

Related posts about emacs

Related posts about regex