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

[AU3基础] 已解决 有多个定位字符时,如何用正则捕获

[复制链接]
发表于 2015-6-19 08:47:42 | 显示全部楼层 |阅读模式
本帖最后由 qazwsxedc 于 2015-7-2 11:22 编辑

字符串中有2句,但有4个‘.’,如何用正则捕获?
"Ceramics are not typically formed from the melt. This is because most ceramics will crack extensively (i.e. form a powder) upon cooling from the liquid  state."
发表于 2015-6-19 10:37:15 | 显示全部楼层
你要捕获什么?捕获点还是字符串?还是捕获罪犯?还是捕获野生动物?
cbslp 该用户已被删除
发表于 2015-6-23 10:00:14 | 显示全部楼层
发表于 2015-6-23 17:51:39 | 显示全部楼层
就你上面这个字符串的话,下面这个可以分出两个句子..


#include <array.au3>

$str = "Ceramics are not typically formed from the melt. This is because most ceramics will crack extensively (i.e. form a powder) upon cooling from the liquid  state."

$arr = StringRegExp($str,"(?:[^()]|(?:\(.+\)))+?\.",3)
_ArrayDisplay($arr)
 楼主| 发表于 2015-6-29 08:40:42 | 显示全部楼层
回复 4# www378660084

谢谢! 要的就是这个结果。
另外,当字符串改为
Ceramics are not typically formed from the melt. This is because most ceramics will crack extensively, i.e. form a powder, upon cooling from the liquid  state.
且不用","替换表达式中的"()"时,如何得到同样的结果
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-16 18:48 , Processed in 0.072057 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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