Я пытаюсь с помощью регулярного выражения получить только URL-адреса всех видео о $pattern, но мое $regex не работает (в данном случае $pattern = "Greta"):
$data = '
some another title
some another title
some another title
Greta Thunberg talk about ...
some another title
some another title
some another title
another video of Greta Thunberg
some another title
some another title
Israel and Greta Thunberg
some another videosome another video...';
$XR = '(href)([^(href)].*).*Greta.*?';
$XR = 'href.*!(href).*Greta.*?';
$XR = '(href)(.*[^(href)]).*Greta.*?';
$XR = 'href.*!href.*Greta.*?';
$XR = 'href.*?.*Greta.*?';
preg_match_all("@$XR@", $data, $match);
print_r($match);
Я использую href.*!href.*Greta.*?, потому что мне нужно поймать href только один раз каждый раз
пожалуйста, помогите
для этих $data моя цель — получить этот вывод в массив $match:
Подробнее здесь: https://stackoverflow.com/questions/798 ... ut-pattern