找回密码
 加入
搜索
查看: 2466|回复: 4

[AU3基础] 如何删除含有某个字符串的行

[复制链接]
发表于 2015-4-20 22:50:19 | 显示全部楼层 |阅读模式
删除含有qqqq的那一行,怎么删


qwertyuio
qwertyuioqwertyuio
qwertyuio
qqqqw
qwertyuio
发表于 2015-4-20 23:40:24 | 显示全部楼层
本帖最后由 Huiseyu 于 2015-4-20 23:45 编辑

凑合着用吧,没学好。
$str =           '1qwertyuio' _
                 & @cr & '2qwertyuioqwertyuio' _
                 & @cr & '3qwertyuio' _
                 & @cr & '4qqqqw' _
                 & @cr & '5AddStr_qqqqw' _
                 & @cr & '6qwertyuio'
MsgBox(8096, 'old', $str)
MsgBox(8096, 'New', StringRegExpReplace($str, 'qqqq.+|\w+(qqqq.+)', ''))
发表于 2015-4-20 23:42:27 | 显示全部楼层
本帖最后由 Huiseyu 于 2015-4-21 05:17 编辑
凑合着用吧,没学好。
Huiseyu 发表于 2015-4-20 23:40



    提醒一下:这是,针对英文字符的。
   刷新一下,这次应该是楼主想要的?
$Strd = 'qqqq'

$StrSa =           '1-- qwertyuio -- 1' _
                 & @CR & '2-- qwertyuioqwertyuio --2 ' _
                 & @CR & '3-- qwertyuio  --3' _
                 & @CR & '4-- qqqqw --4' _
                 & @CR & '5-- wqqqq --5' _
                 & @CR & '6-- qwertyuio --6'
MsgBox(8096, 'Finding "'&$Strd&'" --', $StrSa)
MsgBox(8096, 'Where is the  "'& $Strd &'"  ^_^', StringRegExpReplace($StrSa, '\b(\w.+|\d.*)'&$Strd&'.+\s', ''))
原来正则在于:实践|尝试
发表于 2015-4-21 00:55:26 | 显示全部楼层
发表于 2015-4-21 05:25:50 | 显示全部楼层
好吧,LZ可能不满意,之前是指定单词“qqqq”的所在行
又小小修改了以下 - -! 。含有指定单字符重复2次以上的所在行(包含2次),呵呵,我也发个UDF去。
$Strd = 'q'

$StrSa =           '1-- qwertyuio -- 1' _
                 & @CR & '2-- qwertyuioqwertyuio --2 ' _
                 & @CR & '3-- qwertyuio  --3' _
                 & @CR & '4-- qqqqw --4' _
                 & @CR & '5-- wqqqq --5' _
                 & @CR & '6-- qwertyuio --6'
MsgBox(8096, 'Finding "'&$Strd&'" --', $StrSa)
MsgBox(8096, 'Where is the  "'& $Strd &'"  ^_^', StringRegExpReplace($StrSa, '\b(\w.+|\d.*)'&$Strd&'{2,}.+\s', ''))
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-9 12:44 , Processed in 0.075054 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表