【发布时间】:2012-10-12 03:51:38
【问题描述】:
我想随后在两条路径之间提取文本 sn-p 在一个长字符串中。
因此,我使用这样的东西:
while($data=~ m/\"(.:\\.*?)\".:\\/sg){...}
`\".:\\(.*?) 是前面带有" 的路径。
并且,由于两条路径之间的部分可以是任何字符,
我以下一条路径的开头完成正则表达式:\".:\\
不幸的是,代码总是会跳过一个匹配项。我相信,
也就是说,这是因为后续搜索将在最后一个 \".:\\ 之后开始,因此它只会找到下一个。
如何确定搜索的位置指针已设置
回到正则表达式最后一部分之前(之前:\".:\\)
编辑:
"y:\car\main.cs@@jung" "Added format of version number to all sub-parts.
"Hallo Peter"
@@@ "tool kit" @@@"
"y:\car\main.cs@@kkla" (lkaskdn awdiwj)
"The filter "function of the new version works with Excel 2007"only,
but is the correct filter structure.
@@@ "Huihu boy" @@@"
这个文件应该在 $1 中给我两个结果:
1.
y:\car\main.cs@@jung" "Added format of version number to all sub-parts.
"Hallo Peter"
@@@ "tool kit" @@@"
2.
y:\car\main.cs@@kkla" (lkaskdn awdiwj)
"The filter "function of the new version works with Excel 2007"only,
but is the correct filter structure.
@@@ "Huihu boy" @@@"
但它只会给我第一个。
【问题讨论】:
-
嗨,你是对的,它很低。但是,如果答案不够好怎么办?