GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / SearchTextRegex Method / SearchTextRegex(String,Int32,Boolean) Method
The given regex pattern to search for.
Set this parameter to true if you want to apply case-sensitive search, otherwise set it to false.





In This Topic
SearchTextRegex(String,Int32,Boolean) Method
In This Topic
Searches for and highlights an occurrence of a given regex pattern within the current page of the document displayed in the GdViewer control according to the parameters you have specified. If the format of the displayed document is other than supported text-based formats, which currently are DOCX, TXT, RTF and PDF, the method will fail.

This method uses InvariantCulture comparison when searching. It means, that characters are comparing using culture-sensitive sort rules and the invariant culture, in other words this method respects accents when searching.

Please, be aware that this method changes highlighted regions or the rectangle of area selection depending on the Occurrence parameter as follows:

  1. The currently defined highlighted regions, if present, changes to the regions identified by all occurrences of the found text, if you search for all of them. You can use the RemoveAllRegions method before starting new search to ensure the previously defined regions will remove.
  2. The current rectangle of area selection changes to the text found if you search for the specific occurrence. You can identify it using the IsRect method or you can clear the previous rectangle's data using the ClearRect method.

Syntax
'Declaration
 
Public Overloads Function SearchTextRegex( _
   ByVal Pattern As String, _
   ByVal Occurence As Integer, _
   ByVal CaseSensitive As Boolean _
) As Boolean
public bool SearchTextRegex( 
   string Pattern,
   int Occurence,
   bool CaseSensitive
)
public function SearchTextRegex( 
    Pattern: String;
    Occurence: Integer;
    CaseSensitive: Boolean
): Boolean; 
public function SearchTextRegex( 
   Pattern : String,
   Occurence : int,
   CaseSensitive : boolean
) : boolean;
public: bool SearchTextRegex( 
   string* Pattern,
   int Occurence,
   bool CaseSensitive
) 
public:
bool SearchTextRegex( 
   String^ Pattern,
   int Occurence,
   bool CaseSensitive
) 

Parameters

Pattern
The given regex pattern to search for.
Occurence
CaseSensitive
Set this parameter to true if you want to apply case-sensitive search, otherwise set it to false.

Return Value

true if the given given regex pattern has been found on the current page according to the specified parameters, otherwise false. The GetStat method can be subsequently used to determine if this method has been successful.
Remarks
This method is only useful for text-based document formats, like DOCX, TXT, RTF and PDF.

Be aware that setting the Occurrence parameter to 0 causes, that regions determined by this search replace the currently defined highlighted regions. In addition to this, the current rectangle of selection changes to the text found using the Occurrence parameter greater than 0.

See Also