I want a regular expression to fetch any URL between double quotes.
<a href="http://www.any-web_address.com">
<a href="http://142.12.64.71:8083">
I want a regular expression to fetch any URL between double quotes.
<a href="http://www.any-web_address.com">
<a href="http://142.12.64.71:8083">
"http://[0-9 a-z A-Z . : ]{1,100}"
Something like this?
\"\K([\w\:\/\.\-]+)
If You want with double quotes (it was said "fetch any url between double quotes" so I thought without \"):
\"([\w\:\/\.\-]+)\"
Here is my suggestion (in case your regex flavour supports lookarounds):
(?<=href="|link="|src=")(((http|https)(:\/\/))?([\/\w\-]{2,})(([\.])([\w\-]*)){1,})([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-]*)(?=")
If you do not reduce the scope of your problem, this post : Why it's not possible to use regex to parse HTML/XML: a formal explanation in layman's terms may help you. Else, for instance if you only want the URIs after href=
, you can do this like that :
/(?:href=")(.[^"]*)"/g