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 workbook's worksheets. See ReplaceRegex(string, string, XlsxFindOptions?).

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> and <code>\){name} stand for what was captured.

options XlsxFindOptions

How to match, or null for the defaults.

Returns

XlsxReplaceResult

What was replaced and what was skipped.

Exceptions

ArgumentNullException

pattern or replacement is null.

ArgumentException

pattern is not a valid regular expression.

RegexMatchTimeoutException

A match attempt exceeded RegexTimeout.

InvalidDocumentException

A sheet's part is malformed.