Regex to match exact phrase, nothing before or after the phrase

To match the exact line "Mountain" use this: /^Mountain$/

You haven't mentioned what language you're working in, so the exact form of the pattern might have to change.


If you have a string that contains multiple lines, the following two regular expressions may help:

\r\nWORD\r\n|^WORD\r\n|\r\WORD$|^WORD$

\r\nA\sPHRASE\r\n|^A\sPHRASE\r\n|\r\A\sPHRASE$|^A\sPHRASE$