# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/(?:http(s)?:\/\/)?([a-z][-\w]+(?:\.\w+)+(?:\S+)?)/<a href="http$1:\/\/$2" target="_blank" title="$0">$0<\/a>/ig;t' <<< "Here is a sentence with a url containing a query string: https://www.google.com/search?q=mickmackusa&oq=mickmackusa&aqs=chrome..69i57j69i60.271j0j7&sourceid=chrome&ie=UTF-8 all good.
http://google.com
http://google.com.au
https://google.com.au
www.google.com
google.com
I went to the local food store and bought some food.\n\nI was able to find everything
I went to the local food store and bought some food.
I was able to find everything"
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html