正则表达式在线生成工具txt2re

本文介绍一款实用的正则表达式在线匹配工具,通过简单的三步操作,即可实现字符串参数的精确匹配。首先,在输入框中输入目标字符串;其次,选择匹配模式并点击相应按钮;最后,查看下方同步显示的匹配代码,方便快捷地获取所需正则表达式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://txt2re.com/index-java.php3

 

 简单例子:

 

 

一、在1输入框输入想要匹配的字符串参数,点击Show Matches
二、在2里面会显示字符串,然后点击所要匹配的字符串格式,可以一对一匹配,可以整体匹配
三、在下面会同步显示出相应的代码,选择自己想要的代码 

1.需要python环境2.7/3.6 2.使用方式:python 脚本名 url [可选参数s:数字] [可选参数c:True/False] 3.可选参数s的作用:指定从第几个'/'(不计算'://'中的'/')之前的字符串作为前缀,之后的正则化 默认为1 如:https://blog.csdn.net/dQCFKyQDXYm3F8rB0/article/details/123123 python rule_url_py2 "https://blog.csdn.net/dQCFKyQDXYm3F8rB0/article/details/123123" python rule_url_py2 "https://blog.csdn.net/dQCFKyQDXYm3F8rB0/article/details/123123" -s 2 可选参数-s的值为1和2,执行结果分别为: 1:https://blog\.csdn\.net/([^/]+/){3}[0-9]+ 2:https://blog\.csdn\.net/dQCFKyQDXYm3F8rB0/([^/]+/){2}[0-9]+ 4.可选参数c的作用:用来判定是否清除参数,默认值为false, 如:http://sports.sina.com.cn/zl/football/ihht3.shtml?cre=zhuanlanpc&mod=g python rule_url_py2 "http://sports.sina.com.cn/zl/football/ihht3.shtml?cre=zhuanlanpc&mod=g" python rule_url_py2 "http://sports.sina.com.cn/zl/football/ihht3.shtml?cre=zhuanlanpc&mod=g" -c True 可选参数c为False和True的结果分别为: False: http://sports\.sina\.com\.cn/([^/]+/){2}[a-zA-Z0-9]+\.[a-zA-Z]+\?cre=[^&]*&mod;=[^&]* True: http://sports\.sina\.com\.cn/([^/]+/){2}[a-zA-Z0-9]+\.[a-zA-Z]+\
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值