|
|
|
C# WinApp ช่วยหน่อยครับ Regex ดึงค่าออกมาแต่ติดค่าที่มี > ครับ |
|
|
|
|
|
|
|
ข้อมูลครับ
Code
Analyst P.Mongkon
Date Started 13:54 24/1/2017
Worksheet Zn_Cal_Blank 2017
Comment
Methods Zn
Method: Zn (Flame)
ZnDis 0.000 mg/L >100 0.0003 -0.0022 0.0001 0.0018 0.0002
-0.0002 -0.0006 0.0011
0.0000 -0.0010 0.0002
0.0008 0.0005 0.0005
0.0014 0.0005 0.0004
0.0013 0.0013 -0.0012
-0.0006 0.0000
ZnBlank 0.000 mg/L >100 0.0005 -0.0008 0.0007 0.0003 0.0005
0.0008 -0.0003 0.0012
0.0007 0.0009 0.0013
0.0004 0.0007 0.0002
-0.0005 0.0011 0.0006
-0.0001 0.0002 -0.0008
0.0005 0.0017
ZnDis 0.000 mg/L >100 0.0005 -0.0012 0.0012 0.0008 0.0002
0.0006 0.0002 0.0002
0.0008 0.0015 0.0012
0.0004 0.0000 0.0011
0.0002 -0.0001 0.0003
0.0001 0.0004 0.0007
-0.0002 0.0001
Zn0.02 mg/L 0.018 mg/L 3.2 0.0176 -0.0010 0.0190 0.0176 0.0182
0.0182 0.0176 0.0177
0.0174 0.0174 0.0175
0.0181 0.0176 0.0168
0.0180 0.0181 0.0172
0.0178 0.0164 0.0173
0.0176 0.0173
ZnDis 0.001 mg/L >100 0.0007 -0.0005 0.0052 0.0007 0.0010
0.0008 0.0007 0.0002
0.0010 -0.0004 0.0006
0.0004 0.0004 0.0005
-0.0007 0.0016 -0.0001
0.0007 0.0007 0.0010
0.0002 -0.0001
Zn0.50 mg/L 0.336 mg/L 0.5 0.3356 0.0005 0.3371 0.3365 0.3356
0.3337 0.3343 0.3344
0.3332 0.3370 0.3381
0.3376 0.3349 0.3372
0.3360 0.3358 0.3346
0.3377 0.3344 0.3330
0.3366 0.3351
ZnDis 0.001 mg/L >100 0.0006 0.0020 0.0029 0.0006 0.0012
0.0004 0.0012 0.0001
0.0003 0.0000 0.0006
0.0001 0.0010 0.0011
0.0006 0.0011 -0.0003
0.0003 0.0005 0.0011
-0.0011 0.0008
Zn1.00 mg/L 0.632 mg/L 0.7 0.6322 0.0019 0.6280 0.6290 0.6245
0.6340 0.6293 0.6302
0.6293 0.6350 0.6264
0.6358 0.6319 0.6281
0.6305 0.6348 0.6358
0.6312 0.6367 0.6321
0.6432 0.6376
ZnDis 0.001 mg/L >100 0.0005 0.0015 0.0009 0.0018 0.0015
0.0002 -0.0001 0.0005
0.0013 0.0006 0.0011
-0.0001 -0.0003 0.0010
0.0009 0.0009 0.0006
0.0003 0.0003 -0.0009
-0.0003 -0.0002
ค่าที่ต้องการประมาณนี้ครับ
Code
ZnBlank 0.000 mg/L >100 0.0005 -0.0008 0.0007 0.0003 0.0005
0.0008 -0.0003 0.0012
0.0007 0.0009 0.0013
0.0004 0.0007 0.0002
-0.0005 0.0011 0.0006
-0.0001 0.0002 -0.0008
0.0005 0.0017
rexgex
Code
string strRegex = "\n" + @"(.*?)\s{15,}[-.\d]{1,}\s{1,}mg/L\s{1,}[-.\d]{1,}\s{1,}[-.\d]{1,}\s{1,}[-.\d]{1,}\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})";
ตรง
Code
mg/L >100
mg/L\s{1,}[-.\d]{1,} มันใส่ mg/L\s{1,}[>-.\d]{1,} แล้ว error ครับ
Tag : .NET, Win (Windows App), C#, Windows
|
|
|
|
|
|
Date :
2017-02-09 11:02:47 |
By :
lamaka.tor |
View :
755 |
Reply :
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ปิดกระทู้นะครับทำได้แล้วครับ
Code
string strRegex = "\n" + @"(.*?)\s{15,}[-.\d]{1,}\s{1,}mg/L\s{1,}[\W\d]{1,}\s{1,}[-.\d]{1,}\s{1,}[-.\d]{1,}\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})";
ใช้
[\W\d]
ครับ
|
|
|
|
|
Date :
2017-02-09 11:16:28 |
By :
lamaka.tor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string strRegex = "\n" + @"(.*?)\s{15,}[-.\d]{1,}\s{1,}mg/L\s{1,}[\W\d]{1,}\s{1,}[-.\d]{1,}\s{1,}[-.\d]{1,}\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})\s{1,}([-.\d]{1,})" + "\n" + @"\s{1,}([-.\d]{1,})\s{1,}\s{1,}([-.\d]{1,})";
==>>>> ยาาวมากกกกกกกก
|
|
|
|
|
Date :
2017-02-09 11:47:47 |
By :
fonfire |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Great
|
|
|
|
|
Date :
2017-02-09 13:15:35 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมว่าเอามาแปลงให้เป็น CSV แล้ว Import ได้ไหมครับ
แต่มันมีหลายบรรทัดด้วยนี่นา
|
ประวัติการแก้ไข 2017-02-09 13:34:02
|
|
|
|
Date :
2017-02-09 13:32:45 |
By :
fonfire |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันเป็นประมาณนี้เลยเหรอครับ
น่าจะพอแปลง format ได้น่ะครับ
ถ้าเงื่อนไขของไฟล์มันชัดเจน
|
|
|
|
|
Date :
2017-02-09 13:58:16 |
By :
fonfire |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมลองเอามา Replace ข้อความดู
มันได้ประมาณนี้อ่ะครับ
Code
Analyst,P.Mongkon
Date Started,13:54 24/1/2017
Worksheet,Zn_Cal_Blank 2017
Comment,
Methods,Zn
Method: Zn (Flame)
ZnDis,0.000,mg/L,>100,0.0003,-0.0022,0.0001,0.0018,0.0002,-0.0002,-0.0006,0.0011,0.0000,-0.0010,0.0002,0.0008,0.0005,0.0005,0.0014,0.0005,0.0004,0.0013,0.0013,-0.0012,-0.0006,0.0000
ZnBlank,0.000,mg/L,>100,0.0005,-0.0008,0.0007,0.0003,0.0005,0.0008,-0.0003,0.0012,0.0007,0.0009,0.0013,0.0004,0.0007,0.0002,-0.0005,0.0011,0.0006,-0.0001,0.0002,-0.0008,0.0005,0.0017
ZnDis,0.000,mg/L,>100,0.0005,-0.0012,0.0012,0.0008,0.0002,0.0006,0.0002,0.0002,0.0008,0.0015,0.0012,0.0004,0.0000,0.0011,0.0002,-0.0001,0.0003,0.0001,0.0004,0.0007,-0.0002,0.0001
Zn0.02 mg/L,0.018,mg/L,3.2,0.0176,-0.0010,0.0190,0.0176,0.0182,0.0182,0.0176,0.0177,0.0174,0.0174,0.0175,0.0181,0.0176,0.0168,0.0180,0.0181,0.0172,0.0178,0.0164,0.0173,0.0176,0.0173
ZnDis,0.001,mg/L,>100,0.0007,-0.0005,0.0052,0.0007,0.0010,0.0008,0.0007,0.0002,0.0010,-0.0004,0.0006,0.0004,0.0004,0.0005,-0.0007,0.0016,-0.0001,0.0007,0.0007,0.0010,0.0002,-0.0001
Zn0.50 mg/L,0.336,mg/L,0.5,0.3356,0.0005,0.3371,0.3365,0.3356,0.3337,0.3343,0.3344,0.3332,0.3370,0.3381,0.3376,0.3349,0.3372,0.3360,0.3358,0.3346,0.3377,0.3344,0.3330,0.3366,0.3351
ZnDis,0.001,mg/L,>100,0.0006,0.0020,0.0029,0.0006,0.0012,0.0004,0.0012,0.0001,0.0003,0.0000,0.0006,0.0001,0.0010,0.0011,0.0006,0.0011,-0.0003,0.0003,0.0005,0.0011,-0.0011,0.0008
Zn1.00 mg/L,0.632,mg/L,0.7,0.6322,0.0019,0.6280,0.6290,0.6245,0.6340,0.6293,0.6302,0.6293,0.6350,0.6264,0.6358,0.6319,0.6281,0.6305,0.6348,0.6358,0.6312,0.6367,0.6321,0.6432,0.6376
ZnDis,0.001,mg/L,>100,0.0005,0.0015,0.0009,0.0018,0.0015,0.0002,-0.0001,0.0005,0.0013,0.0006,0.0011,-0.0001,-0.0003,0.0010,0.0009,0.0009,0.0006,0.0003,0.0003,-0.0009,-0.0003,-0.0002
|
ประวัติการแก้ไข 2017-02-10 15:22:32
|
|
|
|
Date :
2017-02-10 15:21:53 |
By :
fonfire |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมลองใน editplus อ่ะครับ
ไม่ได้เขียนโปรแกรม
|
|
|
|
|
Date :
2017-02-10 17:30:21 |
By :
fonfire |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|