$string = 'Получаю только https://test.com/list?list=LLYRGq_jXSq6b3_BA текст а не ссылки http://veg.net/?pomidor=ogurec%131%ea%f в тексте. И все равно не то'; $pattern = '/https?.*\s/u'; echo preg_replace($pattern, "" ,$string); In general, in this mask I try to select links from http (s) to the first following space, but, unfortunately, the selection is too much. How to actually capture only the link and the first space after it?
