Regex find a string with hypones in it

I’m trying to find email within text that is being followed by a key word ‘domain’
preg_match_all("/domain.+b([a-z0-9-]+@[a-z]{2,3})/im", $input_lines, $output_array);

my input data is

here is some text
capture this domain hi-there-welcome.co
and this domain should be captured yes90well.com
but not this link nolink.com
but not this line of no domain on it

I should be able to capture hi-there-welcome.com and yes90well.com


Source: stackoverflow-php

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