Trying to build a regular expression that will match all strings that begin with word "med-" and end with ".opol.nei.com" like this one
med-fe3-ua-kiol-33.opol.nei.com
Trying to build a regular expression that will match all strings that begin with word "med-" and end with ".opol.nei.com" like this one
med-fe3-ua-kiol-33.opol.nei.com
Wayne Yux answer might match more than what is intended. med-.*.opol.nei.com
will match any character instead of the dots.
For example: med-abcXopolYneiZcom
will match the regex above.
To be more specific the dots should be escaped like this: med-.*\.opol\.nei\.com
. Here the dot is interpreted as a dot only.
$
at the end of the regex, it match something likemed-ecbv.opol.nei.comTEST
if not (usinggrep "med-.*\.opol\.nei\.com$"
command) – damadam Nov 21 '19 at 11:06^
for matching the begenning, it match Amed-ecbv.opol.nei.com if not ( usinggrep "^med-.*\.opol\.nei\.com$"
command) – damadam Nov 21 '19 at 11:13