Replace

Replaces a search string in the content of each input document with new content.

Usage

  • Replace(string search, ContextConfig content)

    Replaces all occurrences of the search string in every input document with the string value of the returned object. This allows you to specify different content depending on the execution context.

    • search

      The string to search for.

    • content

      A delegate that returns the content to replace the search string with.

  • Replace(string search, DocumentConfig content)

    Replaces all occurrences of the search string in every input document with the string value of the returned object. This allows you to specify different content for each document depending on the input document.

    • search

      The string to search for.

    • content

      A delegate that returns the content to replace the search string with.

  • Replace(string search, Func<Match, IDocument, Object> contentFinder)

    Replaces all occurrences of the search string in every input document with the string value of the objects returned by the delegate. The delegate will be called for each Match in the supplied regular expression.

    • search

      The string to search for (interpreted as a regular expression).

    • contentFinder

      A delegate that returns the content to replace the match.

  • Replace(string search, Func<Match, Object> contentFinder)

    Replaces all occurrences of the search string in every input document with the string value of the objects returned by the delegate. The delegate will be called for each Match in the supplied regular expression.

    • search

      The string to search for (interpreted as a regular expression).

    • contentFinder

      A delegate that returns the content to replace the match.

  • Replace(string search, params IModule[] modules)

    The specified modules are executed against an empty initial document and the resulting document content replaces all occurrences of the search string in every input document (possibly creating more than one output document for each input document).

    • search

      The string to search for.

    • modules

      Modules that output the content to replace the search string with.

  • Replace(string search, Object content)

    Replaces all occurrences of the search string in every input document with the string value of the specified object.

    • search

      The string to search for.

    • content

      The content to replace the search string with.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • IsRegex(RegexOptions regexOptions = 0)

    Indicates that the search string(s) should be treated as a regular expression(s) with the specified options.

    • regexOptions

      The options to use (if any).

GitHub