找回密码
 加入
搜索
查看: 1978|回复: 1

[AU3基础] [已解决]神奇的字符串,请教一个正则公式

[复制链接]
发表于 2015-1-6 07:57:39 | 显示全部楼层 |阅读模式
本帖最后由 elexy 于 2015-1-7 07:26 编辑

[相关参数:p_admin_account = 123456789 p_fund_account = 38268877 p_branch_no = 0 p_exchange_type = 2 ]

account 里面的数字位数随机,有时候9位,有时候10位,有时候11位,有时候前面有个字母,即A44557780

求取第一个admin  account的值,有可能是字母开头
Local $Str = '[相关参数:p_admin_account = 123456789 p_fund_account = 38268877 p_branch_no = 0 p_exchange_type = 2 ]'
Local $Test = StringRegExpReplace($str, ???, '$1')
MsgBox(0, $Test, $Str)
无意中发现把代码粘到编辑器里,会出来个 FS 符号,不知道咋回事

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2015-1-6 12:47:34 | 显示全部楼层
Local $Str = '[相关参数:p_admin_account = 123456789 p_fund_account = 38268877 p_branch_no = 0 p_exchange_type = 2 ]'
Local $Test = StringRegExp($str, '\w?\d+', 1)
If Not @Error Then MsgBox(0, $Test[0], $Str)
发表于 2015-1-6 23:21:23 | 显示全部楼层
Local $Str = '[相关参数:p_admin_account = A123456789 p_fund_account = 38268877 p_branch_no = 0 p_exchange_type = 2 ]'
;Local $Test = StringRegExp($str, '\w?\d+', 3)                                
;Local $Test = StringRegExp($str, '\w? *\= *(\w+)', 3)
Local $Test = StringRegExp($str, '\w?\s*\=\s*(\w+)', 3)

if @error then
        msgbox(48,0,"Error!")
Else
        _ArrayDisplay($Test,"测试2 - test")
Endif
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-21 18:42 , Processed in 0.090916 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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