I am trying to create regex expression (to use with Stylish extension for Firefox) that will render true for every string that has youtube.com
, however will render false if string contains /user/
or /channel/
.
Example
True
https://www.youtube.com/feed/trending
False
https://www.youtube.com/user/whateva/featured
https://www.youtube.com/channel/lfjafjsldsf
I don't even know where to start, tried to learn regex several times, but its beyond my understanding how it works.
I believe this should do it:
^.*youtube\.com((?!\/user\/|\/channel\/).)*$
See live demo
Proposed solution is using negative lookahead. For more information on that see: