ReplaceRegex()
Contents
[
Hide
]Presentation::ReplaceRegex(System::SharedPtr<System::Text::RegularExpressions::Regex>, System::String, System::SharedPtr<IFindResultCallback>) method
Replaces all matches of the regular expression with the specified string.
void Aspose::Slides::Presentation::ReplaceRegex(System::SharedPtr<System::Text::RegularExpressions::Regex> regex, System::String newText, System::SharedPtr<IFindResultCallback> callback) override
Arguments
Parameter | Type | Description |
---|---|---|
regex | System::SharedPtr<System::Text::RegularExpressions::Regex> | The regular expression System::Text::RegularExpressions::Regex to get strings to replace. |
newText | System::String | The string to replace all occurrences of the strings to be replaced. |
callback | System::SharedPtr<IFindResultCallback> | The callback object for receiving search results IFindResultCallback. |
Remarks
The following code sample shows how to replace text using regular expression with the specified string.
auto presentation = System::MakeObject<Presentation>(u"SomePresentation.pptx");
auto regex = System::MakeObject<System::Text::RegularExpressions::Regex>(u"\\b[^\\s]{10,}\\b");
// Replace all words with 10 or more characters with '<em><strong>'
presentation->ReplaceRegex(regex, u"</strong></em>", nullptr);
presentation->Save(u"SomePresentation-out.pptx", SaveFormat::Pptx);
See Also
- Typedef SharedPtr
- Class Regex
- Class String
- Class IFindResultCallback
- Class Presentation
- Namespace Aspose::Slides
- Library Aspose.Slides