Method ReplaceRegex
ReplaceRegex(string, string, XlsxFindOptions?)
Replaces every match of a regular expression in the sheet's cells.
public XlsxReplaceResult ReplaceRegex(string pattern, string replacement, XlsxFindOptions? options = null)
Parameters
patternstringThe .NET regular expression.
replacementstringThe replacement, in which
\(1</code>, <code>\){name}and$&stand for what was captured.optionsXlsxFindOptionsHow to match, or null for the defaults.
Returns
- XlsxReplaceResult
What was replaced and what was skipped. See ReplaceText(string, string, XlsxFindOptions?).
Exceptions
- ArgumentNullException
patternorreplacementis null.- ArgumentException
patternis not a valid regular expression.- RegexMatchTimeoutException
A match attempt exceeded RegexTimeout.
- InvalidDocumentException
The sheet's part is malformed.