I need to find specific length numbers in a big document. I tried to use regex for this. For example, If I need to search for numbers with exactly 2 digits, I use \d\d (i.e. /d twice followed by a space). This works well.But for finding 10 digit numbers it's not really feasible to type in \d 10 times.Tried \d{2}, says 'E486: Pattern not found: \d{2}'Is there any quicker/easier way to achieve this?
vim search numbers containing specific number of digits
vim;regular expression;search
There are different regular expression dialects; some (e.g. Perl's) do not require backslashes in the quantification modifier (\d{2}), some (e.g. sed) require two (\d\{2\}), and in Vim, only the opening curly needs it (\d\{2}). That's the sad state of incompatible regular expression dialects.Also note that for matching exact numbers, you have to anchor the match so that \d\{2} won't match to digits (12) in 123. This can be done with negative look-behind and look-ahead:\d\@<!\d\{2}\d\@!