Ir para conteúdo
Fórum Script Brasil
  • 0

Bbcode De Novo


Guest Mah Jong

Pergunta

Guest Mah Jong

Achei o seguinte código na net:

<%
'----------------------------------------
' Common Regular Expression Function
'----------------------------------------
Function ReplaceRegExp(strString, strPattern, strReplace)

    Dim RE: Set RE = New RegExp

    With RE
        .Pattern = strPattern
        .Global = True
        ReplaceRegExp = .Replace(strString, strReplace)
    End With
    
End Function

'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

'----------------------------------------
' Turn BBcode into HTML
'----------------------------------------
Function BBCodeToHTML(strString)
    strString = ReplaceRegExp(strString, "(http|ftp|https)(:\/\/[\w\-_]+)((\.[\w\-_]+)+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?", "<a href=""$1$2$3$5"" target=""_blank"">$1$2$3$5</a>")
    strString = ReplaceRegExp(strString, "\[color=([^\]]*)\]([^\[]*)\[/color\]", "<span style=""color: $1;"">$2</span>")
    strString = ReplaceRegExp(strString, "\[size=([^\]]*)\]([^\[]*)\[/size\]", "<font size=""$1"">$2</font>")
    strString = ReplaceRegExp(strString, "\[font=([^\]]*)\]([^\[]*)\[/font\]", "<span style=""font-family: $1, Sans-Serif, Serif;"">$2</span>")
    strString = ReplaceRegExp(strString, "\[quote=([^\]]*)\]([^\[]*)\[/quote\]", "<div class=""quote""><span style=""font-weight: bold; font-size: 8pt;"">$1 said:</span><pre class=""quote1"">$2</pre></div>")
    strString = Replace(strString, "[b]", "<span style=""font-weight: bold;"">")
    strString = Replace(strString, "[B]", "<span style=""font-weight: bold;"">")
    strString = Replace(strString, "[u]", "<span style=""text-decoration: underline;"">")
    strString = Replace(strString, "[U]", "<span style=""text-decoration: underline;"">")
    strString = Replace(strString, "[i]", "<span style="" font-style: italic;"">")
    strString = Replace(strString, "[I]", "<span style="" font-style: italic;"">")
    strString = Replace(strString, "[/b]", "</span>")
    strString = Replace(strString, "[/B]", "</span>")
    strString = Replace(strString, "[/u]", "</span>")
    strString = Replace(strString, "[/U]", "</span>")
    strString = Replace(strString, "[/i]", "</span>")
    strString = Replace(strString, "[/I]", "</span>")
    strString = Replace(strString, "[/i]", "<ul><li>")
    strString = Replace(strString, "[LI]", "<ul><li>")
    strString = Replace(strString, "[Li]", "<ul><li>")
    strString = Replace(strString, "[lI]", "<ul><li>")
    strString = Replace(strString, "[/li]", "</li></ul>")
    strString = Replace(strString, "[/LI]", "</li></ul>")
    strString = Replace(strString, "[/Li]", "</li></ul>")
    strString = Replace(strString, "[/lI]", "</li></ul>")
    BBCodeToHTML = strString
End Function

'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

%>

Como faço para utilizá-lo ?? Eu consigo formatar uma frase, mas preciso aprender ou obter um código para implementar as tags como fazemos aqui no fórum ??

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...