Issue
I can't see what I'm missing in my grep command, can you?
echo "2021-05-09 15:38:56.888 T:1899877296 NOTICE: VideoPlayer::OpenFile:plugin://plugin.video.arteplussept/play/SHOW/069083-002-A" | grep -oE "\w+(?=\/play)/g" -
Expect: arteplussept
Solution
You need to
- Use the PCRE regex engine, with
-P
option, not-E
(which stands for POSIX ERE) - Remove
/g
,grep -o
extracts all matches and there is no need to "embed" this modifier into the pattern - There is no need to escape
/
So, you can just use
grep -oP '\w+(?=/play)'
Answered By - Wiktor Stribiżew