How can I match a hyperlink starting with https://
and ending with .mp4
?
For example I would like to match https://examle.com/abc.mp4
from the following string. However, with pattern https://.*?\.mp4
the previous hyperlinks are also matched (shown in bold).
https://examle.com https://examle.com https://examle.com https://examle.com/abc.mp4 https://examle.com https://examle.com https://examle.com
CodePudding user response:
This pattern should work for you:
https:\/\/[^\/] \/[^.] \.mp4
CodePudding user response:
Use
https:\/\/\S*?\.mp4
See regex proof.
\S*?
- zero or more characters different from whitespace (as few as possible).