String.Split function's limitation?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to break this html statement at the "<!---->"

<br><a href='www.link1.com'>Link1</a><!----><br><a
href='www.link2.com'>Link2</a><!----><br><a
href='www.link3.com'>Link3</a><!---->

If I use string.split command, it splits based on the first "<" in "<!---->"
and not the whole <!---->. It works fine with single delimter like commas,
colons etc.. Is there another way to do this?

Thanks for your help.

V
 
Hi varad
Try this cod
-------------------------------------------------------------------------------------
Dim svlTemp As String = "<br><a href='www.link1.com'>Link1</a><!----><br><a
href='www.link2.com'>Link2</a><!----><br><a
href='www.link3.com'>Link3</a><!---->"
Dim svlArray() As String
Dim objSplit As System.Text.RegularExpressions.Regex
svlArray = objSplit.Split(svlTemp, "<!---->",
RegexOptions.Singleline Or RegexOptions.IgnoreCase Or RegexOptions.Multiline)

For Each ArrValue As String In svlArray
MsgBox(ArrValue)
Nex
-------------------------------------------------------------------------------------
This examble uses simple regular expressions.
for detaild info plese refer the following locations.

http://msdn.microsoft.com/library/d...s/cpguide/html/cpconCOMRegularExpressions.asp

http://www.regular-expressions.info/dotnet.html

String.split function is to split the strings by a single charactor.

consider
svlTemp = "hai,bie:see(yiu"
u want to split it to hai & bye & see & you
u can use
svlTemp.split(",:(".toCharArray()) it splits the the svlTemp into above
requirement

Regards
Prakash
 
Back
Top