VB Code aber mit ASP

Boli

Erfahrenes Mitglied
PHP Code !

Code:
    $blub = eregi_replace("\\[url\\]www.([^\\[]*)\\[/url\\]","<a href=\"http://www.\\1\" target=_blank>\\1</a>",$blub);
    $blub = eregi_replace("\\[url\\]([^\\[]*)\\[/url\\]","<a href=\"\\1\" target=_blank>\\1</a>",$blub);


ASP Code für dick schreiben !
Code:
strcomment = Replace(strcomment, "[ b ]", "<b>")
strcomment = Replace(strcomment, "[ /b ]", "</b>")

Nun möchte ich gerne das mit ASP machen für einen Link [ URL ]...[ /URL ]
nur habe ich gar keinen Plan weil das in PHP so kompliziert aussieht und ich im mom nur ASP kann.Kann mir jemand helfen ?

greetz b0li
 
hi,
naja ich kann die reg ex nicht so, hier mal ohne


Dim iCurrentLocation ' Our current position in the input string
Dim iLinkStart ' Beginning position of the current link
Dim iLinkEnd ' Ending position of the current link
Dim strLinkText ' Text we're converting to a link
Dim strOutput ' Return string with links in it


iCurrentLocation = 1


Do While InStr(iCurrentLocation, strInput, "http://", 1) <> 0
iLinkStart = InStr(iCurrentLocation, strInput, "http://", 1)

iLinkEnd = InStr(iLinkStart, strInput, " ", 1)

If iLinkEnd = 0 Then iLinkEnd = Len(strInput) + 1

Select Case Mid(strInput, iLinkEnd - 1, 1)
Case ".", "!", "?"
iLinkEnd = iLinkEnd - 1
End Select

strOutput = strOutput & Mid(strInput, iCurrentLocation, iLinkStart - iCurrentLocation)

strLinkText = Mid(strInput, iLinkStart, iLinkEnd - iLinkStart)

strOutput = strOutput & "<b><A HREF=""" & strLinkText & """ target=""_blank"" title=""" & strLinkText & """>link</A></b>"

iCurrentLocation = iLinkEnd
Loop


strOutput = strOutput & Mid(strInput, iCurrentLocation)
 
Hier ist ein funktioniernder CODE

Code:
'Loop through the message till all or any hyperlinks are turned into HTML hyperlinks
    Do While NOT InStr(1, strMessage, "[ URL=", 1) = 0 AND NOT InStr(1, strMessage, "[ /URL]", 1) = 0

					    	
	'Find the start position in the message of the [ URL= code
	lngLinkStartPos = InStr(1, strMessage, "[ URL=", 1)
																
	'Find the position in the message for the [ /URL] closing code
	lngLinkEndPos = InStr(lngLinkStartPos, strMessage, "[ /URL]", 1) + 6
					
	'Read in the code to be converted into a hyperlink from the message
	strMessageLink = Trim(Mid(strMessage, lngLinkStartPos, (lngLinkEndPos - lngLinkStartPos)))	
	
	'Place the message link into the tempoary message variable
	strTempMessageLink = strMessageLink
		
	'Format the link into an HTML hyperlink
	strTempMessageLink = Replace(strTempMessageLink, "[ URL=", "<a href=""", 1, -1, 1)
	strTempMessageLink = Replace(strTempMessageLink, "[ /URL]", """ target=""_blank"">", 1, -1, 1)
		
	'Place the new fromatted hyperlink into the message string body
	strMessage = Replace(strMessage, strMessageLink, strTempMessageLink, 1, -1, 1)		
    Loop
 
danke für die behauptung das mein code nicht funktionieren sollte. F U
 
:)

Ich hab deinen nicht getestet !
Hab das aus einem ASP Forum

Wollte ihn nur posten für alle anderen !
 
Das mit dem (Hier ist ein funktioniernder CODE) hat nix mit deinem zu tun :)

Jetzt haben wir halt 2 Möglichkeiten TTrek *gg*

hätte ich anders schreiben solln :)

Hier ist noch ein funktioniernder CODE :)
 
Zurück