TextSearchOptions

TextFragmentAbsorber.TextSearchOptions property

Gets or sets search options. The options enable search using regular expressions.

public TextSearchOptions TextSearchOptions { get; set; }

Examples

The example demonstrates how to perform search text using regular expression.

// Open document
Document doc = new Document(@"D:\Tests\input.pdf");

// Create TextFragmentAbsorber object
TextFragmentAbsorber absorber = new TextFragmentAbsorber();

// make the absorber to search all words starting 'h' and ending 'o' using regular expression.
absorber.Phrase = @"h\w*?o";
absorber.TextSearchOptions = new TextSearchOptions(true);

// we should find "hello" word and replace it with "Hi"
doc.Pages[1].Accept(absorber);
absorber.TextFragments[1].Text = "Hi"; 

// Save document
doc.Save(@"D:\Tests\output.pdf"); 

See Also