ACTIVE SERVER PAGE > ASP Á¤±Ô½Ä - ±âº» »ç¿ë¹ý
µî·ÏÀÏ : 2017-07-03 20:17
Á¶È¸¼ö : 68,117
- Á¤±Ô½Ä »ç¿ë¹ý
Dim objRegExp, strOutput
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True '// ´ë¼Ò¹®ÀÚ ±¸ºÐ ¿©ºÎ
objRegExp.Global = True '// Àüü °Ë»ö¿©ºÎ
objRegExp.Pattern = Á¤±Ô½ÄÆÐÅÏ
strOutput = objRegExp.Replace(°Ë»ö¹®ÀÚ¿, ¹Ù²Ü¹®ÀÚ¿)
Set objRegExp = Nothing
- ÀÚÁÖ »ç¿ëÇÏ´Â Á¤±Ô½Ä
^°¡-힣 '// ÇѱÛ
[^-0-9 ] '// ¼ýÀÚ
[^-a-zA-Z] // ¿µ¹®
<[^>]*> '// ű×ÀÌ¿Ü
[^-°¡-힣a-zA-Z0-9/ ] '// ÇѱÛ+¿µ¹®+¼ýÀÚ
[^-a-zA-Z0-9/ ] '// ¿µ¹®+¼ýÀÚ
\<(\/?)(script)([^<>]*)> '// ½ºÅ©¸³Æ®
Function Word_check(str,patrn)
Dim regEx, match, matches
SET regEx = New RegExp
regEx.Pattern = patrn ' ÆÐÅÏÀ» ¼³Á¤ÇÕ´Ï´Ù.
regEx.IgnoreCase = True ' ´ë/¼Ò¹®ÀÚ¸¦ ±¸ºÐÇÏÁö ¾Êµµ·Ï ÇÕ´Ï´Ù.
regEx.Global = True ' Àüü ¹®ÀÚ¿À» °Ë»öÇϵµ·Ï ¼³Á¤ÇÕ´Ï´Ù.
SET Matches = regEx.Execute(str)
if 0 < Matches.count then
Word_check = false
Else
Word_check = true
end if
End Function
pattern0 = "[^°¡-힣]" 'Çѱ۸¸
pattern1 = "[^-0-9 ]" '¼ýÀÚ¸¸
pattern2 = "[^-a-zA-Z]" '¿µ¾î¸¸
pattern3 = "[^-°¡-힣a-zA-Z0-9/ ]" '¼ýÀÚ¿Í ¿µ¾î Çѱ۸¸
pattern4 = "<[^>]*>" 'ű׸¸
pattern5 = "[^-a-zA-Z0-9/ ]" '¿µ¾î ¼ýÀÚ¸¸
Response.write Word_check("Ã־ȱԸÚÀïÀÌ",pattern0)
ÀÌ·¸°Ô ÇϽøé true³ªfalse°¡ ¹Ýȯ µË´Ï´Ù.