::: Zany's Homepage ::: Zany Wiki | »çÀÌÆ® ÅëÇÕ °Ë»ö
 
 
 

Á¤±Ô½ÄÀ» »ç¿ëÇÏ¿© URL ÀÚµ¿ ¸µÅ©

°Ô½ÃÆÇ
ASP;Active Server Page
ÀÛ¼ºÀÚ
helix
ÀÛ¼ºÀÏ
2009-05-19 21:03:27
ÀÐÀº¼ö
5928
ÆòÁ¡
   
Ç¥½Ã¿É¼Ç
HTML»ç¿ë | ÀÚµ¿BRűנ| °ø¹é¹®ÀÚÇã¿ë | °¡¿îµ¥Á¤·Ä | °íÁ¤Æø±Û²Ã | ÀÚµ¿URL¸µÅ© | ¸¶¿ì½º¼±ÅÃ
°ü·Ã¸µÅ©01
http://blog.naver.com/webjeck?Redirect=Log&logNo=120000836933 
' --------------------------------------------------------
' Function Name        : regular_replace
' Description          : Á¤±ÔÇ¥Çö½ÄÀ» ÀÌ¿ëÇÑ ´ëÄ¡
' --------------------------------------------------------
Function eregi_replace(pattern, replace, text)

Dim eregObj

Set eregObj= New RegExp
eregObj.Pattern= pattern ' Set Pattern(ÆÐÅÏ ¼³Á¤)
eregObj.IgnoreCase    = True ' Set Case Insensitivity(´ë¼Ò¹®ÀÚ ±¸ºÐ ¿©ºÎ)
eregObj.Global= True ' Set All Replace(Àüü ¹®¼­¿¡¼­ °Ë»ö)

eregi_replace = eregObj.Replace(text, replace)    ' Replace String

End Function

' --------------------------------------------------------
' Function Name: auto_link
' Description: ¹®¼­¿¡ ÀÖ´Â 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)
    text = eregi_replace("<(a)[^>]*(href)[^>]*(" & 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

Response.Write auto_link("¿©±â¿¡¿øÇÏ´ÂÅؽºÆ®¸¦ ³ÖÀ¸¼¼¿ä")




ÆÛ¿È. °ËÁõ ¾ÈµÊ.
Á¤±Ô½ÄÀº RegexBuddy ·Î ÀϺΠ°ËÁõµÊ.

 °Ô½ÃÆÇ ±Û ¸ñ·Ï
No Subject Poster Hits Posted
helix 5928 2009-05-19 21:03:27
1815 helix 6398 2009-02-20 12:14:15
1814 helix 4040 2009-02-20 12:06:39
1561 helix 5435 2007-04-18 23:55:35
1493 helix 3747 2007-03-29 11:54:10
1475 helix 3342 2007-03-15 16:02:48
ÄÚ¸àÆ®
ÀÛ¼ºÀÚ
                       
 
zany.kr
  Copyright ¨Ï 2002-2010 Zany's Programming Lab. All Rights Not Reserved.
temporary This Page loads on 0.016 Secs