(adsbygoogle = window.adsbygoogle || []).push({}); O_o :: 'img' 태그의 글 목록

'img'에 해당되는 글 1건

  1. 2008.11.17 vb 문서 내용에 있는 Url를 찾아내어 자동으로 링크를 구성하는 함수

vb 문서 내용에 있는 Url를 찾아내어 자동으로 링크를 구성하는 함수

|

 ' --------------------------------------------------------
' 문서 내용에 있는 Url를 찾아내어  자동으로 링크를 구성하는 함수
' --------------------------------------------------------  
Function auto_link(text)
 Dim regex_file, regex_http, regex_mail
   
 regex_file= "gz|tgz|tar|gzip|zip|rar|mpeg|mpg|exe|rpm|dep|rm|ram|asf|ace|viv|avi|mid|gif|jpg|png|bmp|eps|mov"
 regex_http = "(http|https|ftp|telnet|news):\/\/(([\xA1-\xFEa-z0-9_\-]+\.[][\xA1-\xFEa-z0-9:;&#@=_~%\?\/\.\,\+\-]+)(\/|[\.]*[a-z0-9]))"
 regex_mail = "([\xA1-\xFEa-z0-9_\.\-]+)@([\xA1-\xFEa-z0-9_\-]+\.[a-z0-9\-\._\-]+[\.]*[\xA1-\xFEa-z0-9\?=]*)"
   
 ' img tag 와 a tag 의 경우 링크가 여러줄에 걸쳐 이루어져 있을 경우
 ' 이를 한줄로 합침 (합치면서 부가 옵션들은 모두 삭제함)
 text = eregi_replace("<(a|img)[^>]*(href|src)[^>]*(" & regex_http & "|mailto:" & regex_mail & ")[^>]*>","<$1 $2=""$3"">", text)
   
 ' 특수문자와 링크시 target 삭제
 text = eregi_replace("&(quot|gt|lt)","!$1", text)
 
 ' html 사용시 Link 보호
 text  = eregi_replace("href=""(" & regex_http & ")""[^>]*>","href=""$2_orig://$3"" target=""_blank"">", text)
 text  = eregi_replace("href=""mailto:(" & regex_mail & ")"">","href=""
mailto:$2#-#$3"">", text) 
 text  = eregi_replace("(background|codebase|src)[ \n]*=[\n""' ]*(" & regex_http & ")[""']*","$1=""$3_orig://$4""",text)
 
 '링크가 안된 Url및 Email Address 자동 링크
 text  = eregi_replace("(" & regex_http & ")" ,"<a href=""$1"" target=""_blank"">$1</a>", text)
 text  = eregi_replace("(" & regex_mail & ")","<a href=""
mailto:$1"">$1</a>", text)
 ' 보호를 위해 치환된것 복구
 text = eregi_replace("!(quot|gt|lt)","&$1", text)
 text = eregi_replace("(http|https|ftp|telnet|news|mms)_orig","$1", text)
 text = eregi_replace("#-#","@",text)
 ' File Link시 Target을 삭제  
 text = eregi_replace("(\.(" & regex_file & ")"") target=""_blank""","$1", text)
 
 auto_link = text
End Function

And
prev | 1 | next