Table of Contents

Method ReplaceRegex

Namespace
DocWright.Formats.Xlsx
Assembly
DocWright.Formats.Xlsx.dll

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

pattern string

The .NET regular expression.

replacement string

The replacement, in which \(1</code>, <code>\){name} and $& stand for what was captured.

options XlsxFindOptions

How to match, or null for the defaults.

Returns

XlsxReplaceResult

What was replaced and what was skipped. See ReplaceText(string, string, XlsxFindOptions?).

Exceptions

ArgumentNullException

pattern or replacement is null.

ArgumentException

pattern is not a valid regular expression.

RegexMatchTimeoutException

A match attempt exceeded RegexTimeout.

InvalidDocumentException

The sheet's part is malformed.