$text = '
<p>one</p>
<p>two</p>
<p>three</p>
';
$text = preg_replace('#<p>.*?three.*?</p>#i', '', $text);
echo $text;
$text = '
<p>one</p> <p>two</p> <p>three</p>
';
$text = preg_replace('#<p>(?:(?!</p>).)*?three.*?</p>#i', '', $text);
echo $text;
Вот как ещё пример
aasg assg gsaa gggh
Мы ищем sgaa
Нам должно вывести aasg gsaa
\b(?=\w*s)(?=\w*g)(?=(\w*a){2})[sga]{4}\b
s = s.replace(regularBadWord, '*'.repeat(regularBadWord.length));
s = s.replace(regularBadWord, m => '*'.repeat(m.length));
(?:^|\|).*?(?:\||$)[^\s|]*\K|\s
((?:^|\|).*?(?:\||$)[^\s|]*)|\s
$1
groupRegexp := regexp.MustCompile(`/reports/schedule/Group/([0-9]{4,})_([12])_([0-9]{8})_([0-9]{8})\.pdf`)
doc := GetHtml(config.C.GroupPage) // Получение html кода страницы
datesGroup := groupRegexp.FindAllStringSubmatch(doc, -1)
for _, val := range datesGroup {
fmt.Println(val[0], val[1], val[2], val[3], val[4]) // вывод найденных элементов
}
RewriteCond %{QUERY_STRING} (?:^|&)page=(\d+)
RewriteRule ^(.*)$ /$1page/%1/? [R=301,L]
/s
. Тогда (.*)
будет захватывать и символы новой строки..*?($|\w+=-?\d+)
$1