找回密码
 加入
搜索
查看: 523|回复: 3

[AU3基础] 学习正则过程中...求解【已解决】

[复制链接]
发表于 2022-12-6 16:19:09 | 显示全部楼层 |阅读模式
本帖最后由 holley 于 2022-12-6 16:51 编辑

来源:Regex Golf (alf.nu)

示例:

需匹配:
allochirally
anticovenanting
barbary
calelectrical
entablement
ethanethiol
froufrou
furfuryl
galagala
heavyheaded
linguatuline
mathematic
monoammonium
perpera
photophonic
purpuraceous
salpingonasal
testes
trisectrix
undergrounder
untaunted
需排除:
anticker
corundum
crabcatcher
damnably
foxtailed
galvanotactic
gummage
gurniad
hypergoddess
kashga
nonimitative
parsonage
pouchlike
presumptuously
pylar
rachioparalysis
scherzando
swayed
unbridledness
unupbraidingly
wellside

个人研究了一下规律,大致是需匹配字符串中:前3个小写字母会重复出现2次   ,而需排除字符串中只有1个或2个小写字母重复的情况

我使用正则表达式为:
([a-z]{3})\1(?!\1)
只能匹配到连续的重复字符串,求助高手帮忙改良一下~~~

之前只能匹配到5个,改为这样可以匹配7个了
(([a-z]+){3})\1
发表于 2022-12-6 16:33:57 | 显示全部楼层
([a-z]{3})[a-z]*?\1

评分

参与人数 1金钱 +32 收起 理由
holley + 32 不好意思,可能是网页卡住了,结果正确

查看全部评分

发表于 2022-12-10 18:23:30 | 显示全部楼层
其实我没看出来  那些是不要的
 楼主| 发表于 2022-12-11 16:40:54 | 显示全部楼层
veve 发表于 2022-12-10 18:23
其实我没看出来  那些是不要的

需排除的 就是不要的
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-19 00:18 , Processed in 0.075760 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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