|
TextMatchList Class |
Top Previous Next |
|
For a list of all members of this type, see TextMatchList Members.
Description
Represents a list of matches on a given TextLine.
Thread Safety
This class is safe for multithreaded read access.
Remarks
Example
[Visual Basic]
engineSearch = New SearchEngineClass
engineSearch.SearchCriteria.FileName = "*.txt" engineSearch.SearchCriteria.ContainingText = "search" engineSearch.SearchCriteria.LookIn = "c:\search folder"
Dim listResult As SearchResultItemList = engineSearch.Start( False )
' Output the files, with their text lines and hits to the console
Dim buildText As New System.Text.StringBuilder
For nItem As Integer = 0 To (listResult.Count - 1) ' Each item in the list includes information about the found ' item (e.g. its name and path) and also the list of text lines ' found if this was a content search
Dim item As SearchResultItem = listResult(nItem)
buildText.Append(item.Path) buildText.Append(item.FileName) buildText.Append(vbCrLf)
Dim listText As TextLineList = item.TextLineList
For nText As Integer = 0 To (listText.Count - 1) ' Each text line includes the line number and text found and also ' a list showing where the expression matches occurred.
Dim line As TextLine = listText(nText)
Dim listMatch As FLProCoreLib.TextMatchList = line.TextMatchList For nHit As Integer = 0 To (listMatch.Count - 1) buildText.AppendFormat(" {0}:{1} ", listMatch(nHit).Start, listMatch(nHit).Length) Next buildText.Append(vbCrLf) Next Next
System.Console.Write( buildText.ToString() )
|