当前位置: 移动技术网 > IT编程>开发语言>.net > ASP 检测字符串是否包括汉字、数字、韩文、日文,以及其他语种字符的方法

ASP 检测字符串是否包括汉字、数字、韩文、日文,以及其他语种字符的方法

2018年09月30日  | 移动技术网IT编程  | 我要评论

新客网,美丽的日子剧情介绍,快乐大本营2013511

asp 检测字符串是否包括汉字、数字、韩文、日文,以及其他语种字符的方法

网页要用utf-8编码方式,用gb2312编码无法检测。

https://blog.csdn.net/aminfo/article/details/19572449

文件内容如下,请存为test.





测试字符属性



<%dim hashz, hasen, hasnum, keyword

keyword = request("keyword")
if keyword"" then

	hashz = 0
	hasen = 0
	hasnum = 0
	hasjp = 0
	haskr = 0

	'判断汉字
	if regexptest("[\u4e00-\u9fa5]", keyword) then
		hashz = 1
	end if

	'判断英文
	if regexptest("[a-za-z]", keyword) then
		hasen = 1
	end if
	
	'判断数字
	if regexptest("[0-9]", keyword) then
		hasnum = 1
	end if

	'判断日语
	if regexptest("[\u0800-\u4e00]", keyword) then
		hasjp = 1
	end if

	'判断韩语
	if regexptest("[\u3130-\u318f]", keyword) then
		haskr = 1
	elseif regexptest("[\uac00-\ud7a3]", keyword) then
		haskr = 2	
	end if

	response.write  "
关键词:" & keyword & "
汉字 = " & hashz & "
英文 = " & hasen & "
数字 = " & hasnum & "
日文 = " & hasjp & "
韩文 = " & haskr end if function regexptest(patrn, strng) dim regex, retval ' 建立变量。 set regex = new regexp ' 建立正则表达式。 regex.pattern = patrn ' 设置模式。 regex.ignorecase = false ' 设置是否区分大小写。 retval = regex.test(strng) ' 执行搜索测试。 if retval then regexptest = true else regexptest = false end if end function%>

">


附上:unicode编码布局如下,如需判断其它编码字符,只需将正则表达式中的编码范围替换为以下对应的编码范围及可。

unicode 到目前为止所定义的五个平面中,第0平面(bmp)最为重要,其编码分布如下:
注:中文范围 4e00-9fbf:cjk 统一表意符号 (cjk unified ideographs)
0000-007f:c0控制符及基本拉丁文 (c0 control and basic latin)
0080-00ff:c1控制符及拉丁文补充-1 (c1 control and latin 1 supplement)
0100-017f:拉丁文扩展-a (latin extended-a)
0180-024f:拉丁文扩展-b (latin extended-b)
0250-02af:国际音标扩展 (ipa extensions)
02b0-02ff:空白修饰字母 (spacing modifiers)
0300-036f:结合用读音符号 (combining diacritics marks)
0370-03ff:希腊文及科普特文 (greek and coptic)

microsoft word
0400-04ff:西里尔字母(cyrillic)
0500-052f:西里尔字母补充 (cyrillic supplement)
0530-058f:亚美尼亚语 (armenian)
0590-05ff:希伯来文 (hebrew)
0600-06ff:阿拉伯文 (arabic)
0700-074f:叙利亚文 (syriac)
0750-077f:阿拉伯文补充 (arabic supplement)
0780-07bf:马尔代夫语 (thaana)
07c0-077f:西非书面语言 (n'ko)
0800-085f:阿维斯塔语及巴列维语(avestan and pahlavi)
0860-087f:mandaic
0880-08af:撒马利亚语 (samaritan)
0900-097f:天城文书 (devanagari)
0980-09ff:孟加拉语 (bengali)
0a00-0a7f:锡克教文 (gurmukhi)
0a80-0aff:古吉拉特文 (gujarati)
0b00-0b7f:奥里亚文 (oriya)
0b80-0bff:泰米尔文 (tamil)
0c00-0c7f:泰卢固文 (telugu)
0c80-0cff:卡纳达文 (kannada)
0d00-0d7f:德拉维族语 (malayalam)
0d80-0dff:僧伽罗语 (sinhala)
0e00-0e7f:泰文 (thai)
0e80-0eff:老挝文 (lao)
0f00-0fff:藏文 (tibetan)
1000-109f:缅甸语 (myanmar)
10a0-10ff:格鲁吉亚语(georgian)
1100-11ff:朝鲜文 (hangul jamo)
1200-137f:埃塞俄比亚语 (ethiopic)
1380-139f:埃塞俄比亚语补充 (ethiopic supplement)
13a0-13ff:切罗基语 (cherokee)
1400-167f:统一加拿大土著语音节 (unified canadian aboriginal syllabics)
1680-169f:欧甘字母 (ogham)
16a0-16ff:如尼文(runic)
1700-171f:塔加拉语 (tagalog)
1720-173f:hanunóo
1740-175f:buhid
1760-177f:tagbanwa
1780-17ff:高棉语 (khmer)
1800-18af:蒙古文 (mongolian)
18b0-18ff:cham
1900-194f:limbu
1950-197f:德宏泰语 (tai le)
1980-19df:新傣仂语 (new tai lue)
19e0-19ff:高棉语记号 (kmer symbols)
1a00-1a1f:buginese
1a20-1a5f:batak
1a80-1aef:lanna
1b00-1b7f:巴厘语 (balinese)
1b80-1bb0:巽他语 (sundanese)
1bc0-1bff:pahawh hmong
1c00-1c4f:雷布查语(lepcha)
1c50-1c7f:ol chiki
1c80-1cdf:曼尼普尔语(meithei/manipuri)
1d00-1d7f:语音学扩展 (phonetic extensions)
1d80-1dbf:语音学扩展补充 (phonetic extensions supplem unicode ent)
1dc0-1dff:结合用读音符号补充 (combining diacritics marks supplement)
1e00-1eff:拉丁文扩充附加 (latin extended additional)
1f00-1fff:希腊语扩充 (greek extended)
2000-206f:常用标点(general punctuation)
2070-209f:上标及下标 (superscripts and subscripts)
20a0-20cf:货币符号 (currency symbols)
20d0-20ff:组合用记号 (combining diacritics marks for symbols)
2100-214f:字母式符号 (letterlike symbols)
2150-218f:数字形式 (number form)
2190-21ff:箭头 (arrows)
2200-22ff:数学运算符 (mathematical operator)
2300-23ff:杂项工业符号 (miscellaneous technical)
2400-243f:控制图片 (control pictures)
2440-245f:光学识别符 (optical character recognition)
2460-24ff:封闭式字母数字 (enclosed alphanumerics)
2500-257f:制表符 (box drawing)
2580-259f:方块元素 (block element)
25a0-25ff:几何图形 (geometric shapes)
2600-26ff:杂项符号 (miscellaneous symbols)
2700-27bf:印刷符号 (dingbats)
27c0-27ef:杂项数学符号-a (miscellaneous mathematical symbols-a)
27f0-27ff:追加箭头-a (supplemental arrows-a)
2800-28ff:盲文点字模型 (braille patterns)
2900-297f:追加箭头-b (supplemental arrows-b)
2980-29ff:杂项数学符号-b (miscellaneous mathematical symbols-b)
2a00-2aff:追加数学运算符 (supplemental mathematical operator)
2b00-2bff:杂项符号和箭头 (miscellaneous symbols and arrows)
2c00-2c5f:格拉哥里字母(glagolitic)
2c60-2c7f:拉丁文扩展-c (latin extended-c)
2c80-2cff:古埃及语 (coptic)
2d00-2d2f:格鲁吉亚语补充 (georgian supplement)
2d30-2d7f:提非纳文 (tifinagh)
2d80-2ddf:埃塞俄比亚语扩展 (ethiopic extended)
2e00-2e7f:追加标点 (supplemental punctuation)
2e80-2eff:cjk 部首补充 (cjk radicals supplement)
2f00-2fdf:康熙字典部首 (kangxi radicals)
2ff0-2fff:表意文字描述符 (ideographic description characters)
3000-303f:cjk 符号和标点 (cjk symbols and punctuation)
3040-309f:日文平假名 (hiragana)
30a0-30ff:日文片假名 (katakana)
3100-312f:注音字母 (bopomofo)
3130-318f:朝鲜文兼容字母 (hangul compatibility jamo)
3190-319f:象形字注释标志 (kanbun)
31a0-31bf:注音字母扩展 (bopomofo extended)
31c0-31ef:cjk 笔画 (cjk strokes)
31f0-31ff:日文片假名语音扩展 (katakana phonetic extensions)
3200-32ff:封闭式 cjk 文字和月份 (enclosed cjk letters and months)
3300-33ff:cjk 兼容 (cjk compatibility)
3400-4dbf:cjk 统一表意符号扩展 a (cjk unified ideographs extension a)
4dc0-4dff:易经六十四卦符号 (yijing hexagrams symbols)
4e00-9fbf:cjk 统一表意符号 (cjk unified ideographs)
a000-a48f:彝文音节 (yi syllables)
a490-a4cf:彝文字根 (yi radicals)
a500-a61f:vai
a660-a6ff:统一加拿大土著语音节补充 (unified canadian aboriginal syllabics supplement)
a700-a71f:声调修饰字母 (modifier tone letters)
a720-a7ff:拉丁文扩展-d (latin extended-d)
a800-a82f:syloti nagri
a840-a87f:八思巴字 (phags-pa)
a880-a8df:saurashtra
a900-a97f:爪哇语 (javanese)
a980-a9df:chakma
aa00-aa3f:varang kshiti
aa40-aa6f:sorang sompeng
aa80-aadf:newari
ab00-ab5f:越南傣语 (vi?t thái)
ab80-aba0:kayah li
ac00-d7af:朝鲜文音节 (hangul syllables)
d800-dbff:high-half zone of utf-16
dc00-dfff:low-half zone of utf-16
e000-f8ff:自行使用区域 (private use zone)
f900-faff:cjk 兼容象形文字 (cjk compatibility ideographs)
fb00-fb4f:字母表达形式 (alphabetic presentation form)
fb50-fdff:阿拉伯表达形式a (arabic presentation form-a)
fe00-fe0f:变量选择符 (variation selector)
fe10-fe1f:竖排形式 (vertical forms)
fe20-fe2f:组合用半符号 (combining half marks)
fe30-fe4f:cjk 兼容形式 (cjk compatibility forms)
fe50-fe6f:小型变体形式 (small form variants)
fe70-feff:阿拉伯表达形式b (arabic presentation form-b)
ff00-ffef:半型及全型形式 (halfwidth and fullwidth form)
fff0-ffff:特殊 (specials)

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网