I have two strings:
"Some Stuff S00E00 HDTV x264-2HD mp4"
"Some Stuff S00E00 720p HDTV X264"
And this regex:
^.ome.*.tuff.*.(mp4.*|HDTV.*|x264.*)
What I need is to only match the first one. So if the string contains "720" the regex should not match that. But the string has to contain "mp4", "HDTV" or "x264".
If your chosen language / platform supports it, you can use a negative lookahead assertion, like this:
^(?!.*720).ome.*.tuff.*.(mp4.*|HDTV.*|x264.*)
But this can be further simplified to:
^(?!.*720).ome.*tuff.*(mp4|HDTV|x264).*
Demonstration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With