ReplaceRegex()
Contents
[
Hide
]IPresentation::ReplaceRegex(System::SharedPtr<System::Text::RegularExpressions::Regex>, System::String, System::SharedPtr<IFindResultCallback>) method
Replaces all matches of the regular expression with the specified string.
virtual void Aspose::Slides::IPresentation::ReplaceRegex(System::SharedPtr<System::Text::RegularExpressions::Regex> regex, System::String newText, System::SharedPtr<IFindResultCallback> callback)=0
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 IPresentation
- Namespace Aspose::Slides
- Library Aspose.Slides