RegexRedaction
RegexRedaction class
指定された正規表現に一致するドキュメント内のテキストを検索および置換するテキスト リダクションを表します。
public class RegexRedaction : TextRedaction
コンストラクター
| 名前 | 説明 |
|---|---|
| RegexRedaction(Regex, ReplacementOptions) | RegexRedaction クラスの新しいインスタンスを初期化します。 |
| RegexRedaction(string, ReplacementOptions) | RegexRedaction クラスの新しいインスタンスを初期化します。 |
プロパティ
| 名前 | 説明 |
|---|---|
| ActionOptions { get; } | を取得しますReplacementOptionsインスタンス、テキスト置換のタイプを指定します. |
| override Description { get; } | リダクションとそのパラメーターを説明する文字列を返します。 |
| OcrConnector { get; set; } | を取得または設定しますIOcrConnectorグラフィックコンテンツからテキストを抽出するために必要な実装. |
| RegularExpression { get; } | 一致する正規表現を取得します。 |
メソッド
| 名前 | 説明 |
|---|---|
| override ApplyTo(DocumentFormatInstance) | 特定のフォーマット インスタンスにリダクションを適用します。 |
備考
もっと詳しく知る
例
次の例は、正規表現を使用してテキストを置換する方法を示しています。
using (Redactor redactor = new Redactor(@"C:\sample.pdf"))
{
// テキストに置き換える
redactor.Apply(new RegexRedaction("\\d{2}\\s*\\d{2}[^\\d]*\\d{6}", new ReplacementOptions("[removed]")));
// 青い実線の長方形に置き換えます
redactor.Apply(new RegexRedaction(@"^\d+[,\.]{1}\d+$", new ReplacementOptions(System.Drawing.Color.Blue)));
redactor.Save();
}
関連項目
- class TextRedaction
- 名前空間 GroupDocs.Redaction.Redactions
- 組み立て GroupDocs.Redaction