Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - Trovare parola in un testo
Forum - C# / VB.NET - Trovare parola in un testo

Avatar
Vicar (Normal User)
Pro


Messaggi: 96
Iscritto: 25/02/2010

Segnala al moderatore
Postato alle 19:46
Venerdė, 11/03/2011
Questo topic č stato chiuso dal moderatore

Ciao,
come posso fare a ricerca un testo di inizio tipo <div> e un testo di fine </div> e prendere il contenuto al suo interno?

Grazie per l'aiuto e le risposte :D

Per ora ho fatto questo ma non Matcha niente..
Codice sorgente - presumibilmente VB.NET

  1. Dim Body_RG As New Regex("<body(?s:.*?)</body>", RegexOptions.Multiline)
  2.  
  3.         For Each M As Match In Body_RG.Matches(HTML)
  4.             Dim Temp As String
  5.             Temp = M.Groups(1).Value
  6.             'Temp = String.Format("{0}", M.Groups(1).Value)
  7.  
  8.         Next
  9.  Return HTML


Ultima modifica effettuata da Vicar il 11/03/2011 alle 21:19
PM
Avatar
Vicar (Normal User)
Pro


Messaggi: 96
Iscritto: 25/02/2010

Segnala al moderatore
Postato alle 21:37
Venerdė, 11/03/2011
Dopo ben un'ora a sbatterci la testa, Manvbnet mi ha postato il codice corretto:

Codice sorgente - presumibilmente VB.NET

  1. Dim Body_RG As New Regex("<body(?<Content>(?s:.*?))</body>", RegexOptions.Multiline)
  2.         For Each M As Match In Body_RG.Matches(HTML)
  3.             HTML = M.Groups("Content").Value
  4.         Next


PM