Is searchAndReplace use firstMatch?
or should i use other features?
Hello,
The firstMatch option is available in many template methods such as replaceVariableByText or replacePlaceholderImage. But the searchAndReplace method doesn't include it.
Regards.
Hello,
Template methods such as replaceVariableByText needs to use template placeholders; this is specific symbols wrapping words to set template placeholders ($VAR_1$, ${VAR_MY} ... ). On https://www.phpdocx.com/documentation/practical/working-with-templates is detailed how to work with template documents with phpdocx.
The searchAndReplace method allows doing text replacements without using template placeholders, but as explained in our previous reply this method doesn't include the firstMatch option. The searchAndReplace method can't be replaced with replaceVariableByText; each method has its own purpose and requirements. In the case of replaceVariableByText, template placeholders must be used to do replacements.
Regards.