Jag har provat på samma sätt som dig. Det finns en funktion som jag inte förstår helt och det är "pattern"
Den finns redan i koden förr. Kan det krocka där? Här ser du hur hur det ser ut om det är nått som blir fel där.
Jag vet inte riktigt hur jag ska visa det på bästa sätt. Den andra funktionen är ju till forum svar så det är nog fel tänkt ändå. :r
function NewText( ByVal Text )
'// Kör HTMLEncode och sätt ut radbrytningar
Text = Server.HTMLEncode( Text )
Text = Replace( Text , vbCrLf , "<br>" )
With new RegExp
.IgnoreCase = True
.Global = True
'// RegExp för citera
.Pattern = "\< *quote(?:( *name *= *(?:")*(.*?)(?:")*)){0,1} *>(?:\<br\>)*(.*?)(?:\<br\>)*\</quote *>"
Text = .Replace( Text ,""&_
"<div style = ""margin-left:20px; margin-right:20px; border: 1px solid #cccccc; borderpadding-bottom:5px;"">"&_
"<div style = ""background-color: #ffffea; font-weight: bold; color: #666666;"">"&_
"Citerar $2:"&_
"</div>"&_
"<em style = ""background-color: #ffffea;color: #666666; height: 0px; width: 100%;"">$3</em></div>")
.Pattern = "\< *quote(?:( *name *= *(?:")*(.*?)(?:")*)){0,1} *>(?:\<br\>)*(.*?)(?:\<br\>)*(?:\</quote *>)*"
Text = .Replace( Text ,"<br>"&_
"<div style = ""margin-left:20px; padding-bottom:5px;"">"&_
"<div style = ""padding-left:5px; background-color: #ffffea; font-weight: bold; color: #666666;"">"&_
"Citerar $2:"&_
"</div>"&_
"<em style = ""color: #666666; height: 0px; width: 100%;"">$3")
.Pattern = "(:?\(?:< *quote(?:( *name *= *(?:")*(.*?)(?:")*)){0,1} *>(?:\<br\>)*(.*?)(?:\<br\>)*)*\</quote *>"
Text = .Replace( Text ,"</em></div>")
'// Max 2 radbrytningar efter varandra
.Pattern = "(?:\<br\>){3,}"
Text = .Replace( Text ,"<br>")
End With
NewText = Text
end function
'''''''''''''''''''''''''''''''''''''''''''''
Function FixaLankar(s)
On error resume next
Set objRE = new RegExp
objRE.IgnoreCase = True : objRE.Global = True
objRE.Pattern = "(http:\/\/|www\.)(\w|\&|\:|\;|\.|\/|\?|\~|\=|-)+"
Set m = objRE.Execute(s)
For Each o In m
If Right(o.Value, 1)="." Or Right(o.Value, 1)="!" Or Right(o.Value, 1)="?" Or Right(o.Value, 1)="," Then
If Left(o.Value, 3) = "www" Then s = Replace(s, o.Value, "<A HREF=""http://" & Left(o.Value, Len(o.Value)-1) & """ target=""_blank"">" & Left(o.Value, Len(o.Value)-1) & "</A>" & Right(o.Value, 1)) Else s = Replace(s, o.Value, "<A HREF=""" & Left(o.Value, Len(o.Value)-1) & """>" & Left(o.Value, Len(o.Value)-1) & "</A>" & Right(o.Value, 1))
Else
If Left(o.Value, 3) = "www" Then s = Replace(s, o.Value, "<A HREF=""http://" & o.Value & """ target=""_blank"">" & o.Value & "</A>") Else s = Replace(s, o.Value, "<A HREF=""" & o.Value & """ target=""_blank"">" & o.Value & "</A>")
End If
Next
Set objRE = Nothing
' Tillåten HTML kod
s = Replace(s,"[f]","<b>")
s = Replace(s,"[/f]","</b>")
s = Replace(s,"[k]","<i>")
s = Replace(s,"[/k]","</i>")
s = Replace(s,"[farg]","<font color=#800000>")
s = Replace(s,"[/farg]","</font>")
s = Replace(s, vbCrLf, "<br>")
s = Replace(s,"","")
FixaLankar = s
End Function