In this specific case, you can get the job done without using a non-greedy regex.
Try this non-greedy regex [^/]*
instead of .*?
:
sed 's|\(http://[^/]*/\).*|\1|g'
In this specific case, you can get the job done without using a non-greedy regex.
Try this non-greedy regex [^/]*
instead of .*?
:
sed 's|\(http://[^/]*/\).*|\1|g'