$text = '<span class="wpcf7-form-control wpcf7-acceptance">
<span class="wpcf7-list-item">
<input type="checkbox" name="our-policy" value="1" aria-invalid="false" class="form-check-input" id="our-policy">
</span>
<span class="list-item">
<input type="checkbox" name="our-policy" value="1" aria-invalid="false" class="form-check-input" id="our-policy">
</span>
<span class="wpcf7-list-item">
<input type="checkbox" name="our-policy" value="1" aria-invalid="false" class="form-check-input" id="our-policy">
</span>
</span>';
$patterns = [
'~<span[^>]*wpcf7[^>]*>\s*(<input[^>]+>)\s*</span>~s',
'~<span[^>]*wpcf7[^>]*>(.+)</span>~s'
];
$text = preg_replace($patterns, '$1', $text);
echo $text;
/* Результат:
<input type="checkbox" name="our-policy" value="1" aria-invalid="false" class="form-check-input" id="our-policy">
<span class="list-item">
<input type="checkbox" name="our-policy" value="1" aria-invalid="false" class="form-check-input" id="our-policy">
</span>
<input type="checkbox" name="our-policy" value="1" aria-invalid="false" class="form-check-input" id="our-policy">
*/
Function GetDate(ByVal str As String)
Dim day As String, month As String, year As String
year = Left(str, 2)
month = Mid(str, 3, 2)
day = Mid(str, 5, 2)
If year > 30 Then year = year + 1900 Else year = year + 2000
GetDate = year & "." & month & "." & day
End Function
Sub ПолучитьДату()
Dim result As String
On Error Resume Next
result = InputBox("Введите число", "Диалоговое окно", "921205400655")
ActiveCell = GetDate(result)
End Sub
$str = '<p>без атрибутов</p>
<p align="justify">с атрибутами</p>';
$res = preg_replace('~<\pL+\d?\K.*?(?=>)~', '', $str);
echo $res;
$text = "уменьшает силу\rразмаха.</div>\r\n</div>Также уменьшает...\r\nИ ещё текст";
$patt = "~(?<!</div>|</ul>|</li>)[\r\n]+(?!</?(?:div|ul|li)>)~";
$text = preg_replace($patt, "</p>\n<p>", $text);
echo $text;
$text = '90+3\' SGDGG p[gdsg] sadgcgbcvb';
echo preg_replace('~^[^a-z]+~i', '', $text);
$text = '$.ajax({type: "POST",url: "/dir1/dir2/ajax/ads",data: "view=list",dataType: "html",cache: false,success: function (data) {
}});';
$repl = 'ЗначениеДляЗамены';
$text = preg_replace('~url:\h"\K[^"]+(?=/ajax/ads)~', $repl, $text);
echo $text;
$str = 'Исходный текст и {{}}.';
$dir = 'blog\flowers.txt';
$str = preg_replace_callback(
'~{{\K(?=}})~',
function()use($dir){
return file_get_contents($dir);
},
$str
);
echo $str;
$str = 'Исходный текст и {{}}.';
$dir = 'blog\flowers.txt';
$str = str_replace('{{}}', '{{'. file_get_contents($dir) . '}}', $str);
echo $str;