chishingchan 发表于 2014-2-28 09:29:45

请会正则表达式的帮个忙:提取字符串中的某串字符 [已解决]

本帖最后由 chishingchan 于 2014-2-28 11:08 编辑

某窗口使用 WinGetClassList($Title) 后获取字符串为:
SkinWindow
SkinWindow
ATL:005583B8
SkinWindow
SkinWindow
SkinWindow

查帮助知道,WinGetClassList 的换行符是@LF,请问:
如何使用正则表达式(StringRegExp)获取字符串:ATL:005583B8?谢谢!

骗子 发表于 2014-2-28 09:53:47

\V+
这个好像是匹配所以换行符的吧?

chishingchan 发表于 2014-2-28 10:08:19

临急抱佛脚,现学现编,感觉笨拙!$asResult = StringRegExp(WinGetClassList($Title),'(ATL:........)',1)
If @error = 0 Then
        MsgBox(0, "结果", $asResult)
EndIf

Ycxw2008 发表于 2014-2-28 10:42:09

(?<=ATL\:)\w{8}

chishingchan 发表于 2014-2-28 10:47:21

回复 4# Ycxw2008


缺少了:ATL:

chishingchan 发表于 2014-2-28 10:48:56

(ATL:\w{8}) 好像可以了

afan 发表于 2014-2-28 10:56:44

(?mi)^atl:\V+

chishingchan 发表于 2014-2-28 11:07:14

回复 7# afan


    也行!反正我不懂,能用就行。谢谢!

afan 发表于 2014-2-28 11:09:36

回复 8# chishingchan


    这个很简单,以上那些都行~

Ycxw2008 发表于 2014-2-28 16:53:24

回复 8# chishingchan

我以为你就取数字,{:face (394):}
页: [1]
查看完整版本: 请会正则表达式的帮个忙:提取字符串中的某串字符 [已解决]