ASP正则表达式技巧

来源:asp之家 时间:2011-04-10 11:00:00 


代码如下:

<% 
str = request("str") 
reg = request("reg") 
set regex = new RegExp 
With regex 
.Pattern = reg 
.IgnoreCase = False 
.Global = True 
End With 
Set match = regex.Execute(str) 
If match.Count > 0 Then 
For Each matched in match 
Response.Write "<B><input value=" & matched.Value & " ></B> 位置: <B>" & matched.FirstIndex & "</B> 长 
度:"&matched.Length&"<BR>" 
Next 
Else 
Response.Write "<B>" & regex.Pattern & "</B> 没有找到匹配" 
End If 
Set regex = nothing 
%> 
<form method=post> 
text:<br> 
<textarea cols=50 rows=10 name="str"><%=str%></textarea><br> 
regexp:<input name="reg" value="<%=reg%>"><br> 
<input type=submit value="regexp"> 
</form>


标签:ASP,正则表达式
0
投稿

猜你喜欢

  • pandas DataFrame索引行列的实现

    2023-12-16 09:52:55
  • JS IOS/iPhone的Safari浏览器不兼容Javascript中的Date()问题如何解决

    2023-09-23 19:39:47
  • Python计算一个文件里字数的方法

    2022-09-23 10:28:19
  • pd.DataFrame中的几种索引变换的实现

    2023-03-01 12:19:30
  • PHP使用自定义key实现对数据加密解密的方法

    2023-08-21 12:48:37
  • 针对SQL Server中业务规则链接的分析

    2009-01-20 11:43:00
  • Python UnicodedecodeError编码问题解决方法汇总

    2023-10-07 09:28:20
  • 微信昵称带符号导致插入MySQL数据库时出错的解决方案

    2024-01-20 23:40:20
  • django解决跨域请求的问题详解

    2021-07-21 14:45:45
  • Python针对给定列表中元素进行翻转操作的方法分析

    2022-04-19 18:37:07
  • 双屏显示提升前端开发10%工作效率

    2009-03-16 18:22:00
  • Python Numpy 自然数填充数组的实现

    2023-12-18 16:51:37
  • Python实现的列表排序、反转操作示例

    2023-06-19 11:14:27
  • 通过创建SQLServer 2005到 Oracle10g 的链接服务器实现异构数据库数据转换方案

    2024-01-28 00:05:46
  • numpy创建神经网络框架

    2023-07-10 22:17:50
  • PHP实现的浏览器检查类

    2024-05-13 09:26:24
  • django之常用命令详解

    2023-02-04 07:25:19
  • 用js实现放大镜效果

    2023-09-19 18:29:29
  • 关于Python中浮点数精度处理的技巧总结

    2021-12-28 15:12:53
  • Python字符串拼接的4种方法实例

    2023-01-30 18:57:15
  • asp之家 网络编程 m.aspxhome.com