I was trying to use the following grep command:
grep \'(.*)(?=(png|html|jpg|js|css)(?:\\s*))(png|html|jpg|js|css.*\\s)\' file
File contains the
You are using a PCRE regex with the POSIX BRE engine that is default grep
engine.
To make those patterns work, you should use -P
option (available in GNU grep
):
grep -P 'YOUR_PCRE_PATTERN'
^^
To develop and test PCRE patterns, a well-known regex101.com is usually recommended.
Note that on Mac OS, you may install GNU grep via brew.