0
그래서,이 내 코드입니다 :정규식 임의의 문자 VB.Net
Dim sourceString As String = New System.Net.WebClient().DownloadString("www.example.com")
TextBox2.Text = sourceString
Dim findtext2 As String = "(?<=<div class=""books"">)(.*?)(?=</div>)"
Dim myregex2 As String = TextBox2.Text
Dim doregex2 As MatchCollection = Regex.Matches(myregex2, findtext2)
Dim matches2 As String = ""
For Each match2 As Match In doregex2
matches2 = matches2 + match2.ToString + Environment.NewLine
Next
MsgBox(matches2)
그것은 <div class="books">
및 </div>
사이의 모든 값을지고있어,하지만 하나의 큰 문제가있다.
"books"다음에 3 자 (예 : <div class="books672">
)가 있습니다. example.com에
는 HTML은 다음과 같이이다 :
<div class="books321">Book1</div>
<div class="books785">Book2</div>
<div class="books547">Book3</div>
<div class="books182">Book4</div>
<div class="books317">Book5</div>
<div class="books970">Book6</div>
어떻게 내가 "Book1을, BOOK2 ..."얻을 수 있을까? 임의의 문자에 대한 무언가가 정규식에 존재합니까?
사용할 수있는'' – rock321987
및 예 (정규식 – rock321987
[필수 링크]와 HTML을 구문 분석하지 않습니다 http://stackoverflow.com/a/1732454/5240004) 자신에게 유리하게 HTML 구문 분석 라이브러리를 사용하십시오. – theB