Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 如何在classic ASP中搜索数组中的任何字符?_Arrays_Search_Asp Classic - Fatal编程技术网

Arrays 如何在classic ASP中搜索数组中的任何字符?

Arrays 如何在classic ASP中搜索数组中的任何字符?,arrays,search,asp-classic,Arrays,Search,Asp Classic,我现在有下面的ASP代码,如果在我的搜索字符串中出现一个特殊的非拉丁字符“П”,我会得到如下所示的响应 myQuery = request("myQuery") If InStr(1, myQuery, "д", 1) > 0 then Response.write "Query from languages ...... detected." Else Response.write "Continue searching English/Latin archiv

我现在有下面的ASP代码,如果在我的搜索字符串中出现一个特殊的非拉丁字符“П”,我会得到如下所示的响应

myQuery = request("myQuery")

If InStr(1, myQuery, "д", 1) > 0 then
    Response.write "Query from languages ......  detected." 
 Else 
    Response.write "Continue searching English/Latin archive."
End if
但如何用字符数组替换单个字符:

myArray = Array("ß","ü","ş","ğ", "ä", "д", "ф")

换句话说,我如何检查myArray中的任何字符是否出现在myQuery中?

根据需要,您可以循环使用数组

For Each x In myArray 
    If InStr(1, myQuery, x, 1) > 0 then
        Response.write x + " was detected." 
    Else 
        Response.write "Continue searching English/Latin archive."
    End if
Next
或者使用正则表达式一次性进行测试

Dim myRegExp, FoundMatch
Set myRegExp = New RegExp
myRegExp.Pattern = "[ßüşğäдф]"
FoundMatch = myRegExp.Test(myQuery)

If FoundMatch then
    Response.write "Characters detected." 
Else 
    Response.write "Continue searching English/Latin archive."
End if

非常感谢你。我用了你的注册表。表达式代码和它的工作方式。你帮我省去了几个小时的压力,很高兴这有帮助。标记为已回答。