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

[AU3基础] 【已解决】正则表达式求助...

[复制链接]
发表于 2017-3-20 17:38:55 | 显示全部楼层 |阅读模式
本帖最后由 kemyliu 于 2017-3-21 10:10 编辑

如下这样的一段数据,如何用正则表达式截取出Board,Location,Feature,HeightResult,AreaResult,VolumeResult,Valid,RegResult,BridgeResult这几个栏位的值。
条件是:如果HeightResult,AreaResult,VolumeResult,Valid,RegResult,BridgeResult这5栏中有一项的值是F则截取出Board,Location,Feature,HeightResult,AreaResult,VolumeResult,Valid,RegResult,BridgeResult这些栏位的值出来。通常这几个栏位的值是P.有请正则表达式大神帮忙一下!
Date,Time,PanelID,Board,Location,Feature,HeightResult,Height,HeightUpFail,HeightLowFail,HeightTarget,AreaResult,Area,AreaUpFail,AreaLowFail,AreaTarget,VolumeResult,Volume,VolumeUpFail,VolumeLowFail,VolumeTarget,Valid,RegResult,XOffset,YOffset,RegShort%,RegLong%,RegShort%Fail,RegLong%Fail,BridgeResult,BridgeLength,BridgeFail
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C1,Pad1,P,0.1323,0.25,0.05,0.12,P,3.7979,0.172,0.6881,0.344,P,0.5027,0.8257,0.2064,0.4128,P,P,-0.0084,0.0056,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C1,Pad2,P,0.1343,0.25,0.05,0.12,P,3.633,0.172,0.6881,0.344,P,0.488,0.8257,0.2064,0.4128,P,P,-0.0066,0.0026,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C2,Pad3,P,0.1223,0.25,0.05,0.12,P,3.7772,0.172,0.6881,0.344,P,0.4619,0.8257,0.2064,0.4128,P,P,0.0145,-0.0134,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C2,Pad4,P,0.1273,0.25,0.05,0.12,P,3.6543,0.172,0.6881,0.344,P,0.4653,0.8257,0.2064,0.4128,P,P,0.0115,-0.0129,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C3,Pad5,P,0.1315,0.25,0.05,0.12,P,3.7976,0.172,0.6881,0.344,P,0.4994,0.8257,0.2064,0.4128,P,P,0.0064,-0.0044,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C3,Pad6,P,0.1272,0.25,0.05,0.12,P,3.7018,0.172,0.6881,0.344,P,0.471,0.8257,0.2064,0.4128,P,P,0.008,-0.0118,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C4,Pad7,P,0.1245,0.25,0.05,0.12,P,3.8663,0.172,0.6881,0.344,P,0.4812,0.8257,0.2064,0.4128,P,P,-0.0118,-0.0019,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C4,Pad8,P,0.1322,0.25,0.05,0.12,P,3.6652,0.172,0.6881,0.344,P,0.4845,0.8257,0.2064,0.4128,P,P,-0.0147,-0.0015,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C6,Pad11,P,0.128,0.25,0.05,0.12,P,6.5877,0.2958,1.1832,0.5916,P,0.8434,1.5953,0.3988,0.7976,P,P,-0.0059,-0.0076,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C6,Pad12,P,0.126,0.25,0.05,0.12,P,6.8235,0.295,1.1801,0.59,P,0.86,1.5911,0.3978,0.7956,P,F,0.001,-0.0024,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C9,Pad17,F,0.1257,0.25,0.05,0.12,P,6.84,0.2958,1.1832,0.5916,P,0.8595,1.5953,0.3988,0.7976,P,P,-0.0149,-0.0154,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C9,Pad18,P,0.1316,0.25,0.05,0.12,P,6.6798,0.2958,1.1832,0.5916,P,0.8791,1.5953,0.3988,0.7976,P,P,0.0016,0.0129,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C66,Pad51,P,0.1356,0.25,0.05,0.12,P,13.8036,0.6233,2.4933,1.2467,P,1.8722,3.3244,0.8311,1.6622,P,P,-0.0107,0.0121,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C66,Pad52,P,0.1283,0.25,0.05,0.12,P,13.6215,0.6224,2.4898,1.2449,P,1.7478,3.3197,0.8299,1.6598,P,P,-0.01,-0.0033,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C67,Pad53,P,0.1275,0.25,0.05,0.12,P,3.9125,0.172,0.6881,0.344,F,0.4987,0.8257,0.2064,0.4128,P,F,0.0105,0.0161,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C67,Pad54,P,0.1299,0.25,0.05,0.12,P,3.9367,0.172,0.6881,0.344,P,0.5115,0.8257,0.2064,0.4128,P,P,0.012,0.0132,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C119,Pad97,P,0.1295,0.25,0.05,0.12,P,3.8859,0.172,0.6881,0.344,P,0.5033,0.8257,0.2064,0.4128,P,P,0.002,0.0043,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C119,Pad98,P,0.138,0.25,0.05,0.12,P,3.7091,0.172,0.6881,0.344,P,0.5117,0.8257,0.2064,0.4128,P,P,-0.0011,0.0048,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C160,Pad127,P,0.1363,0.25,0.05,0.12,P,3.7111,0.172,0.6881,0.344,P,0.5059,0.8257,0.2064,0.4128,P,P,0.0008,0.0187,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C160,Pad128,P,0.147,0.25,0.05,0.12,P,3.5351,0.172,0.6881,0.344,P,0.5197,0.8257,0.2064,0.4128,P,P,-0.0021,0.0193,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C161,Pad129,P,0.1361,0.25,0.05,0.12,P,3.6727,0.172,0.6881,0.344,F,0.4997,0.8257,0.2064,0.4128,P,P,0.0032,0.0126,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C161,Pad130,P,0.1429,0.25,0.05,0.12,F,3.464,0.172,0.6881,0.344,P,0.4948,0.8257,0.2064,0.4128,F,F,0.0013,0.0015,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C162,Pad131,P,0.1325,0.25,0.05,0.12,P,3.7609,0.172,0.6881,0.344,P,0.4985,0.8257,0.2064,0.4128,P,F,0.007,-0.0168,0,0,0,0,P,0.08,0.3
03-17-2017,8:28:11,CN01DDN57016373F02EUA00,Image 1,C162,Pad132,P,0.1429,0.25,0.05,0.12,P,3.3801,0.172,0.6881,0.344,P,0.4829,0.8257,0.2064,0.4128,P,P,0.01,-0.0163,0,0,0,0,P,0.08,0.3
 楼主| 发表于 2017-3-20 17:40:48 | 显示全部楼层
本帖最后由 kemyliu 于 2017-3-20 17:45 编辑

上面的数据是含,的CSV文件,请大神帮忙一下!当然不用正则很容易截取出,但因相同格式的数据比较多,想用正则表达式来处理。
发表于 2017-3-20 19:10:53 | 显示全部楼层
可以先拿到符合的行
(?mi)^(?:[^,]+,){3}(.+?,F,\V+)
再分割
 楼主| 发表于 2017-3-21 10:10:15 | 显示全部楼层
回复 3# afan
非常感谢大大!!
发表于 2017-3-27 16:47:53 | 显示全部楼层
我也在不太懂这个正则表达式
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-22 11:49 , Processed in 0.110609 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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