简体   繁体   中英

regex using vb.net

i have this html code

<div class="name"> 

<span id="businessNumOnMap2" class="resultNumberOnMap" style="display:none;">2</span> 

<span>

<a href="/len/aapproximatch%20search/284096.php" onclick="loadBusinessInfo('1', '284096'); return false;" class="businessName">Bangsar Seafood Garden Restaurant</a></span><span id="phoneSpan1"></span>

<script type="text/javascript">
var d=document.getElementById('phoneSpan1');d.innerHTML+='0';d.innerHTML+='3';d.innerHTML+=0?'8':'-';d.innerHTML+=1?'2':'1';d.innerHTML+='2';d.innerHTML+=1?'8':'1';d.innerHTML+=0?'0':'2';d.innerHTML+='2';d.innerHTML+=0?'4':'5';d.innerHTML+='5';d.innerHTML+=1?'5':'0';
</script> 

</div>

i start my regex with this : <div class="name"[^>]*>[\\s\\S]+?</div> and i remove the html. im using this : <[^>]*>

how ever, the out put is Bangsar Seafood Garden Restaurant <script type = "text/javascript"> ...</script><div>

the one that i want is on Bangsar Seafood Garden Restaurant..can anyone help me?

If all you want is the business name, can't you just do a text search for class="businessName" and then take everything between the next > and < . It might not work if the HTML changes, but you run the same risk with Regex.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM