【发布时间】:2011-07-12 15:34:53
【问题描述】:
我在我的网页上使用分页,因此对于我按下的每个字母,它都会显示以该字符开头的记录。但是我的问题是我需要使用 # 来显示除字符之外的所有内容,以便它包含以例如 - 1、323、_、!等开头的记录。我将如何使用正则表达式来比较值,例如 -
if left(selectedRecord, 1) <> "[^a-z]" then
我曾经使用存储过程来执行此操作,但由于分页时复选框有问题,我只是提取所有记录并像这样过滤 -
response.Write "<tr"
if trim(request.Form("selected_Button")) = "#" then
elseif trim(request.Form("selected_Button")) <> lcase(trim(left(objRS("Movies"), 1))) and len(request.Form("selected_Button")) = 1 then
response.Write " style=""display:none;"""
end if
response.Write ">"
所以我的问题是如何修复我在存储过程中使用的 # -
select * from Movies where movies like '[^a-z]%'
分页按钮 -
<center><input id="buttonStyle" type="submit" name="Selected_Button" value="#">
<% for i = 97 to 122 %>
<input id="buttonStyle" type="submit" name="Selected_Button" value="<%=CHR(i) %>">
<% next %></center>
<center></br><input id="buttonStyle" type="submit" name="Selected_Button" value="View All"></center>
编辑:
所以我自己找到了一个解决方案,但我想知道我是否可以在不遍历字母表的情况下做到这一点 -
response.Write "<tr"
if trim(request.Form("selected_Button")) = "#" then
for i = 97 to 122
if lcase(trim(left(objRS("Movies"), 1))) = chr(i) then
response.Write " style=""display:none;"""
end if
next
elseif trim(request.Form("selected_Button")) <> lcase(trim(left(objRS("Movies"), 1))) and len(request.Form("selected_Button")) = 1 then
response.Write " style=""display:none;"""
end if
response.Write ">"
【问题讨论】:
标签: html regex vbscript asp-classic pagination