i have using classic code with parse html desctiption meta is:
Html exaple:
<meta name="keywords" content="Software AG, Altenkesseler Straße 17, Saarbrücken, Saarland, software ag, Ofis" />
Parse Code:
Baslangic = InStr(1,sdata,"<meta name=" & Chr(34) & "keywords" & Chr(34), 1) + Len("<meta name=" & Chr(34) & "keywords" & Chr(34))
Baslangic = InStr(Baslangic,sdata,Chr(34),1)+1
Genislik = InStr(Baslangic,sdata,Chr(34),1) - Baslangic
KeywordAl= Mid(sdata, Baslangic, Genislik)
this is work but when the html code change location of writings for example:
<meta content="Software AG, Altenkesseler Straße 17, Saarbrücken, Saarland, software ag, Ofis" name="keywords" />
it doesnt work my code. Is there a way to run on both sides? regex or on my way.
thank you
if (instr(1, sdata,"<meta ", 1)=1 and instr(7, sdata, "name=""keywords""", 1)>6) then
Set regEx = New RegExp
regEx.Pattern = "content=""(.+?)"""
regEx.IgnoreCase = True
Set matches = regEx.Execute(sdata)
if matches.Count > 0 then
KeywordAl = matches(0).SubMatches(0)
end if
end if
you can try something like this:
meta = "<meta name=""keywords"" content=""Software AG, Altenkesseler Straße 17, Saarbrücken, Saarland, software ag, Ofis"" />"
if InStr( meta, "content=" ) > 0 then
arrMeta = Split( meta, "content=" )
keywords = arrMeta( 1 ) ''-- your data will be in the 2nd row of the array
keywords = Trim( Replace( Replace( Replace( keywords, """", "" ), "/>", "" ), "name=keywords", "" ) )
end if
Response.Write keywords
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.