Issue
I have words like
MEdIa
media
MEDIA
mEdIa
_media_
_media
media_
ICP_MEDIA
in a file. i am trying to grep the keyword media from the below command
grep -irwE "media|*_media"
But grep can find only
MEdIa
media
MEDIA
mEdIa
_media
Not able to find _media_
, media_ ,ICP_MEDIA
Solution
I'm pretty sure someone with better regex foo can provide a nicer solution, but this works for me for a selected set of values (see below):
cat file.txt | grep -iwE "media|.*[\b_]media[\b_]*"
_media_
media
ICP_MEDIA
Values:
_media_
media
ICP_MEDIA
XXX_media_YYY
NOTMEDIA
NOT_MEDIAXX
Answered By - Christian.K Answer Checked By - Clifford M. (WPSolving Volunteer)