Extract URL’s from a string using PHP if any of two special symbols in the URL should be treated as delimiters (the first characters followed by URL)?

To extract URLs (not a perfect solution but I’m almost satisfied as performance counts) I use

preg_match_all('#bhttps?://[^,s()<>]+(?:([wd]+)|([^,[:punct:]s]|/))#', $string, $match);

code to extract URLs.
However, it’s not a perfect solution for me as URLs should be forced to cut up to ] or "|" if any of these two symbols met in the extracted URL.

I know these symbols are valid symbols in URLs, however for my case they should be invalid.
How should the preg_match_all above be slightly modified to know about these two delimiters?
Thank you.

Source: stackoverflow-php