Not sure if I'm doing this right:
This should match a URL beginning with http(s):// and ending with a space character or a & nbsp;
So the problem is this part:
That should mean: match either a white space or a & nbsp; but it doesn't work. It never matches for a & nbsp; and just continues until it finds a white space.
Edit: some kind of bug in the code formatting on this site, there isn't a space between & and nbsp; but this site turns it into a space if I get rid of that separating space.
\S+ bit is greedy, and will match as many non-space characters as possible, including any
that might be there. Change it to it's ungreedy equivalent
\S+?, and you'll probably have better luck:
(Updated because I overlooked the trailing