Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone,
I tried to get some match when I get text html by using webclient.

This is text:

HTML
<a href=\"/Truyen/Kami-no-mizo-Shiru-Sekai/Flag-125\" title=\"Read Kami nomi zo Shiru Sekai Flag. 125\">\r\n     Kami nomi zo Shiru Sekai Flag. 125 - Read Online</a>

<a href=\"/Truyen/Kami-no-mizo-Shiru-Sekai/Flag-125\">Read online</a>


This is regular expression

C#
@"<a\b[^>]*>\b[^>]*>"


But I dont know why I can only get this match, not both of them

HTML
<a href=\"/Truyen/Kami-no-mizo-Shiru-Sekai/Flag-125\">Read online</a>


Any suggest?
Thank.
Posted
Updated 14-Dec-11 11:53am
v2

Try this:
\<a[^>]*>[^>]*\>
 
Share this answer
 
Comments
HeoSuaXongDzoLua 14-Dec-11 22:38pm    
I tried it but it's still received same result :(
AspDotNetDev 14-Dec-11 22:46pm    
It worked for me. Play around with the regex options (one of the parameters in the Regex constructor), especially those dealing with multiline (I think you'll actually want singleline) and the newline character.
HeoSuaXongDzoLua 14-Dec-11 23:01pm    
Oh, sorry, I didn't see \ character.
It worked.
Thank you so much.
I use Expresso[^] Regex editor to do all my regexing and it helps by
breaking down/parsing the expression.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900