Tiago Salgado Posted December 26, 2007 at 03:49 PM Report Share #156354 Posted December 26, 2007 at 03:49 PM De expressões regulares não pesco um paio ... precisava da vossa ajuda para retirar a informação que está em tabelas em HTML. O texto está entre tags deste tipo: <TD CLASS=BlockFont WIDTH='80px'>S825102343</TD> Os atributos dentro da <TD> podem variar. Cumps Link to comment Share on other sites More sharing options...
Rui Carlos Posted December 26, 2007 at 04:35 PM Report Share #156371 Posted December 26, 2007 at 04:35 PM Qualquer coisa como isto: <TD[^>]*>[^<]</TD> A parte é bold é a informação. Rui Carlos Gonçalves Link to comment Share on other sites More sharing options...
Cybernavigator Posted December 26, 2007 at 09:11 PM Report Share #156467 Posted December 26, 2007 at 09:11 PM Ora bem, podes sempre usar esta função Public Function InBetween(ByVal strVariable As String, ByRef str1 As String, ByRef str2 As String, Optional ByRef lngBeginning As Integer = 1) As String On Error Resume Next Dim iBetween As String Dim a As Integer Dim b As Integer Dim c As Integer b = InStr(lngBeginning, strVariable, str1) c = InStr(b + Len(str1), strVariable, str2) If IsDBNull(b) Or IsDBNull(c) Then iBetween = vbNullString Return "" End If strVariable = Replace(strVariable, VB.Right(strVariable, Len(strVariable) - c + 1), vbNullString) strVariable = VB.Right(strVariable, Len(strVariable) - InStr(lngBeginning, strVariable, str1, CompareMethod.Text) - Len(str1) + 1) Return strVariable End Function Que pro teu caso seria qualquer coisa como InBetween("80px'>", "</TD") E obtinhas S825102343 Melhores cumprimentos,João Lopes***Esta mensagem foi escrita ao abrigo do novo Acordo Ortográfico*** Link to comment Share on other sites More sharing options...
Cybernavigator Posted December 31, 2007 at 03:03 AM Report Share #157222 Posted December 31, 2007 at 03:03 AM Já agora, como utilizo isso das expressões regulares? Não topei nada :/ Melhores cumprimentos,João Lopes***Esta mensagem foi escrita ao abrigo do novo Acordo Ortográfico*** Link to comment Share on other sites More sharing options...
Asgorath Posted December 31, 2007 at 10:12 AM Report Share #157233 Posted December 31, 2007 at 10:12 AM http://msdn2.microsoft.com/en-us/library/hs600312.aspx VB101SamplesBCL RegularExpressions "The Dark Side Clouds Everthing. Impossible To See The Future Is."My rig: Intel Core 2 Quad Q9450 | abit IP35P | 4G Kingston 800 Mhz | XFX GeForce 9800 GX2 1G ddr3 | 2X WD5000AAJS 500Gb Sata 2 | PSU 600W || Caixa El-Diablo | Creative XMod Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now