ReplaceRegex
ITextFrame.ReplaceRegex method
Replaces all matches of the regular expression with the specified string.
public void ReplaceRegex(Regex regex, string newText, IFindResultCallback callback)
Parameter | Type | Description |
---|---|---|
regex | Regex | The regular expression Regex to get strings to replace. |
newText | String | The string to replace all occurrences of the strings to be replaced. |
callback | IFindResultCallback | The callback object for receiving search results IFindResultCallback . |
Examples
The following code sample shows how to replace text using regular expression with the specified string.
[C#]
using (Presentation presentation = new Presentation("SomePresentation.pptx"))
{
Regex regex = new Regex(@"\b[^\s]{10,}\b");
// Replace all words with 10 or more characters with '***'
((AutoShape)presentation.Slides[0].Shapes[0]).TextFrame.ReplaceRegex(regex, "***", null);
presentation.Save("SomePresentation-out.pptx", SaveFormat.Pptx);
}
See Also
- interface IFindResultCallback
- interface ITextFrame
- namespace Aspose.Slides
- assembly Aspose.Slides