Partilhar via


ITextSearchService2.Find Method

Definition

Searches for the next occurrence of the search string.

Overloads

Find(SnapshotPoint, String, FindOptions)

Searches for the next occurrence of the search string.

Find(SnapshotSpan, SnapshotPoint, String, FindOptions)

Searches for the next occurrence of the search string.

Remarks

This method is safe to be executed on any thread.

Find(SnapshotPoint, String, FindOptions)

Searches for the next occurrence of the search string.

public:
 Nullable<Microsoft::VisualStudio::Text::SnapshotSpan> Find(Microsoft::VisualStudio::Text::SnapshotPoint startingPosition, System::String ^ searchPattern, Microsoft::VisualStudio::Text::Operations::FindOptions options);
public Microsoft.VisualStudio.Text.SnapshotSpan? Find (Microsoft.VisualStudio.Text.SnapshotPoint startingPosition, string searchPattern, Microsoft.VisualStudio.Text.Operations.FindOptions options);
abstract member Find : Microsoft.VisualStudio.Text.SnapshotPoint * string * Microsoft.VisualStudio.Text.Operations.FindOptions -> Nullable<Microsoft.VisualStudio.Text.SnapshotSpan>
Public Function Find (startingPosition As SnapshotPoint, searchPattern As String, options As FindOptions) As Nullable(Of SnapshotSpan)

Parameters

startingPosition
SnapshotPoint

The position from which to begin the search. The search will be performed on the ITextSnapshot to which this parameter belongs.

searchPattern
String

The pattern to search for.

options
FindOptions

Specifies options used for the search operation.

Returns

A SnapshotSpan containing the match if a match was found, or null if no matches were found.

Exceptions

The UseRegularExpressions flag is set and the search string is an invalid regular expression.

Remarks

This method is safe to be executed from any thread.

Applies to

Find(SnapshotSpan, SnapshotPoint, String, FindOptions)

Searches for the next occurrence of the search string.

public:
 Nullable<Microsoft::VisualStudio::Text::SnapshotSpan> Find(Microsoft::VisualStudio::Text::SnapshotSpan searchRange, Microsoft::VisualStudio::Text::SnapshotPoint startingPosition, System::String ^ searchPattern, Microsoft::VisualStudio::Text::Operations::FindOptions options);
public Microsoft.VisualStudio.Text.SnapshotSpan? Find (Microsoft.VisualStudio.Text.SnapshotSpan searchRange, Microsoft.VisualStudio.Text.SnapshotPoint startingPosition, string searchPattern, Microsoft.VisualStudio.Text.Operations.FindOptions options);
abstract member Find : Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.SnapshotPoint * string * Microsoft.VisualStudio.Text.Operations.FindOptions -> Nullable<Microsoft.VisualStudio.Text.SnapshotSpan>
Public Function Find (searchRange As SnapshotSpan, startingPosition As SnapshotPoint, searchPattern As String, options As FindOptions) As Nullable(Of SnapshotSpan)

Parameters

searchRange
SnapshotSpan

The range of text to search in.

startingPosition
SnapshotPoint

The position from which to begin the search. The search will be performed on the ITextSnapshot to which this parameter belongs.

searchPattern
String

The pattern to search for.

options
FindOptions

Specifies options used for the search operation.

Returns

A SnapshotSpan containing the match if a match was found, or null if no matches were found.

Exceptions

The UseRegularExpressions flag is set and the search string is an invalid regular expression.

Remarks

This method can be executed from any thread.

Applies to