The Computer Oracle

How to search for one of two similar strings in Vim?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5

--

Chapters
00:00 How To Search For One Of Two Similar Strings In Vim?
00:38 Accepted Answer Score 56
00:51 Answer 2 Score 6
01:08 Thank you

--

Full question
https://superuser.com/questions/249597/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#vim #regex

#avk47



ACCEPTED ANSWER

Score 56


/planet\(Awesome\|Terrible\)

To see the relevant documentation, issue :help /, and scroll down to the section “The definition of a pattern”.




ANSWER 2

Score 6


To add to Gilles' answer, you might want to add a few things in there:

/\<planet\(Awesome\|Terrible\)\>

\< marks the beginning of a 'word' (essentially alphanumerics)
\> marks the end of a 'word' (essentially alphanumerics)