Partager via


EditPoint2.FindPattern, méthode (String, Int32, EditPoint%, TextRanges%)

Recherche un modèle donné dans le texte sélectionné.

Espace de noms :  EnvDTE80
Assembly :  EnvDTE80 (dans EnvDTE80.dll)

Syntaxe

'Déclaration
Function FindPattern ( _
    Pattern As String, _
    vsFindOptionsValue As Integer, _
    <OutAttribute> ByRef EndPoint As EditPoint, _
    <OutAttribute> ByRef Tags As TextRanges _
) As Boolean
bool FindPattern(
    string Pattern,
    int vsFindOptionsValue,
    out EditPoint EndPoint,
    out TextRanges Tags
)
bool FindPattern(
    [InAttribute] String^ Pattern, 
    [InAttribute] int vsFindOptionsValue, 
    [InAttribute] [OutAttribute] EditPoint^% EndPoint, 
    [InAttribute] [OutAttribute] TextRanges^% Tags
)
abstract FindPattern : 
        Pattern:string * 
        vsFindOptionsValue:int * 
        EndPoint:EditPoint byref * 
        Tags:TextRanges byref -> bool 
function FindPattern(
    Pattern : String, 
    vsFindOptionsValue : int, 
    EndPoint : EditPoint, 
    Tags : TextRanges
) : boolean

Paramètres

  • EndPoint
    Type : EnvDTE.EditPoint%
    Facultatif.Objet EditPoint représentant le point à déplacer jusqu'à la fin du modèle de texte trouvé.
  • Tags
    Type : EnvDTE.TextRanges%
    Facultatif.Si le modèle correspondant est une expression régulière contenant des sous-expressions avec balises, l'argument Tags contient une collection d'objets TextRange, un pour chaque sous-expression avec balises.

Valeur de retour

Type : System.Boolean
true si le modèle est trouvé ; sinon false.

Implémentations

EditPoint.FindPattern(String, Int32, EditPoint%, TextRanges%)

Notes

FindPattern recherche le modèle de texte donné depuis le point d'édition jusqu'à la fin du document, dans tout le texte, y compris masqué Un indicateur détermine si la recherche commence au début du document. Le modèle peut être une expression régulière ou autre. La valeur retournée indique si le modèle a été trouvé. S'il a été trouvé, le point d'édition se place au début du texte correspondant. Sinon, il ne change pas de position.

Si une valeur EndPoint est fournie et que la recherche aboutit, FindPattern place ce point de terminaison à la fin du modèle trouvé.

Si le modèle correspondant est une expression régulière et contient des sous-expressions avec balises, l'argument Tags retourne une collection d'objets TextRange, un pour chaque sous-expression avec balises.

Exemples

Sub FindPatternExample()
   Dim objTextDoc As TextDocument
   Dim objEditPt As EditPoint, iCtr As Integer
        
   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")
       
   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objEditPt = objTextDoc.StartPoint.CreateEditPoint
        
   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objeditpt.Insert("This is a test." & Chr(13))
   Next iCtr
   objEditPt.StartOfDocument()
   'Search for the word "test."
   If objeditpt.FindPattern("test") = True Then
      msgbox("Found the word.")
   End If
End Sub

Sécurité .NET Framework

Voir aussi

Référence

EditPoint2 Interface

FindPattern, surcharge

EnvDTE80, espace de noms