taji01
taji01

Reputation: 2615

Search VI for letters and numbers

I use vi at work and i have to search for a string of specific letters & numbers such as these:

UTL41650

adr21100

aTL31901

there are always (3)Letters and (5)Numbers. Is there a way to search for these strings easily? Maybe with regex or something else.

Upvotes: 2

Views: 3896

Answers (2)

Denys Séguret
Denys Séguret

Reputation: 382274

Just type

/\v[a-zA-Z]{3}\d{5}

The \v activates the very magic mode to avoid escaping here. What follows is probably self-explanatory, assuming you know that \d is a digit in regular expressions.

Documentation on searching in vim

Upvotes: 5

Joseph
Joseph

Reputation: 357

Regex:

(\w{3})(\d{5})

Also check out

VimRegex

Upvotes: 2

Related Questions