in a very big string I have to delete the [w:r][/w:r] where the substring "delete" exist. Example -of substring I want to delete - :
[w:r w:rsidR="00A37EED" w:rsidRPr="00FE1BE1"][w:rPr][w:b][/w:rPr][w:t]delete[/w:t][/w:r]
This one is my best guess \[w:r.*delete.*\[\/w:r\]
I tried multiple regex expression but it's not my strong suit.
I copy-pasted the string on regex101 here's the link https://regex101.com/r/wS4bL2/1
I succeeded at finding the required pattern but I can't make it stop at the first occurence of [/w:r]
.
PHP code -in case you are wondering- :
$this->tempDocumentMainPart = preg_replace('/\[w:r.*delete.*\[\/w:r\]/','',$this->tempDocumentMainPart);