¦p¦ó³]©wREGEXP PATTERN¤~¯à¨ú¥X¥¿½T¸ê®Æ©O¡H
- ©«¤l
- 231
- ¥DÃD
- 55
- ºëµØ
- 0
- ¿n¤À
- 293
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- KEELUNG
- µù¥U®É¶¡
- 2010-7-24
- ³Ì«áµn¿ý
- 2018-8-28
|
¦U¦ì¤j¤j¦n¡G
¤p§Ì¦³¤GÓ½d¨Ò¡A
²Ä¤@Ó½d¨Ò¡G
Pattern = "\d+\s+(?=¤¸)."
¥i¥H¨ú¥X
100 ¤¸
8000 ¤¸
57 ¤¸
²Ä¤GÓ½d¨Ò
.Pattern = "\d+\s+(?=¤è¤¸)."
¦ý¶È¨ú¥X
100 ¤è
8000 ¤è
57 ¤è
½Ð°Ý¦p¦ó¥i¦P®É¨ú¥X¦r¦ê"¤è¤¸"©O¡H
Sub aa()
Dim regex As New RegExp
Dim sr, mat, m
sr = "abc 100 ¤¸ 8000 ¤¸ 57 ¤¸ efg"
With regex
.Global = True
.Pattern = "\d+\s+(?=¤¸)."
Set mat = .Execute(sr)
For Each m In mat
Debug.Print m
Next m
End With
End Sub
Sub bb()
Dim regex As New RegExp
Dim sr, mat, m
sr = "abc 100 ¤è¤¸ 8000 ¤è¤¸ 57 ¤è¤¸ efg"
With regex
.Global = True
.Pattern = "\d+\s+(?=¤è¤¸)."
Set mat = .Execute(sr)
For Each m In mat
Debug.Print m
Next m
End With
End Sub |
|
|
|
|
|
|
- ©«¤l
- 231
- ¥DÃD
- 55
- ºëµØ
- 0
- ¿n¤À
- 293
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- KEELUNG
- µù¥U®É¶¡
- 2010-7-24
- ³Ì«áµn¿ý
- 2018-8-28
|
ÁÂÁ¦U¦ì¤j¤j¡C
²Ä¤G¶µ¤w§ä¥X¤èªk¥i¸Ñ¨M¤F¡C
³]©w¦p¤U¡G
mPtn = "\d+\s+(?=PCS).{3}" |
|
|
|
|
|
|
- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-8-23 09:23 ½s¿è
¦^´_ 11# dechiuan999
µLªÅ®æ¤]¯à¤Ç°t:
"\d+\s*¤¸"
"\d+\s*¤è¤¸" |
|
|
|
|
|
|
- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-8-23 09:34 ½s¿è
¦^´_ 9# dechiuan999
¬ÛÃöºô¯¸
http://msdn.microsoft.com/en-us/library/1400241x(VS.85).aspx
³o½g¤]ÆZ¦³½ìªº
http://technet.microsoft.com/zh-tw/magazine/2008.05.heyscriptingguy.aspx |
|
|
|
|
|
|
- ©«¤l
- 231
- ¥DÃD
- 55
- ºëµØ
- 0
- ¿n¤À
- 293
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- KEELUNG
- µù¥U®É¶¡
- 2010-7-24
- ³Ì«áµn¿ý
- 2018-8-28
|
¦^´_ 14# stillfish00
ÁÂÁ¤j¤j´£¨Ñ§óºë½oªº»yªk¡A
¤]¦P®É´£¨Ñ¾Ç²ßªººô¯¸¡C
¤p§Ì¹ï¤j¤j¦p¦¹¤F¸ÑREGEXP
EXPRESSªºÀ³¥Î¡C·Q¥²¤w¸g¬O
¥X¯«¤J¤Æªº¹Ò¬É¤F¡C
¤£ª¾¤j¤j¯à§_§Q¥Î¦¹¶é¦a¡A¶}ÅP
¦³ÃöREGEXP EXPRESS¾Ç²ß
«ü«n¡C
³o¼Ë¤]¯à´ç¤Æ§Ú̳o¨Ç±ß½ú¡C
»¡¹ê¦b¡A¦n¨Ç¦~«e´N¦³¦V
OOBIRDª©¥D½Ð敎¹L¡C
¦Ó·í®É¹ê¦b¬O¤£±o¨äªù¦Ó¤J¡C
¦p¤µ¡A¤£·Q¦b¥b³~¦Ó°h¡A
¤]§Æ±æ¯à¼õ¹L³o¬q¾Ç²ßªºµhW´Á¤F¡C
¯¬ºÖ¤j¤j
¨Æ¨Æ¶¶¤ß |
|
|
|
|
|
|
- ©«¤l
- 231
- ¥DÃD
- 55
- ºëµØ
- 0
- ¿n¤À
- 293
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- KEELUNG
- µù¥U®É¶¡
- 2010-7-24
- ³Ì«áµn¿ý
- 2018-8-28
|
¦^´_ 14# stillfish00
¤j¤j±z¦n¡G
¤p§Ì±q¤j²M¦°_¡A´N¶}©l¾Ç²ß³]©w
¤j¤j¤§«e´£¨Ñ¤§»yªk¡A¨Ãµy¥[§ó§ï¤U¦C¦r¦ê¡C
¥u¬OmPtn¤§³]©wÁÙ¬OµLªk¦pÄ@¡A½Ð¤j¤j¦AÀ°
¤p§Ì¬Ý¬Ý¦p¦ó×¥¿pattern©O¡H
mPtn = "PCE|\d+([.]?\d{0,2}|,\d{3}[.]?\d{0,2})*"
22 2 PCE 7,852.60 119,258,226.05
106 2 PCE 10,117,852 226.15
10 11 PCE 17,852 119,258,226.25
1080 118 PCE 1,117,852 119,258
109 1429 PCE 17,852.55 19,258
110 51511 PCE 17,852.70 119,258,226
11125 515 PCE 517,852 9,258,226.75
11.5 515 PCE 6.75 105.5
ÁÂÁ¤j¤j¡I |
|
|
|
|
|
|
- ©«¤l
- 231
- ¥DÃD
- 55
- ºëµØ
- 0
- ¿n¤À
- 293
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- KEELUNG
- µù¥U®É¶¡
- 2010-7-24
- ³Ì«áµn¿ý
- 2018-8-28
|
¦^´_ 16# dechiuan999
ÁÂÁ¦U¦ì¤j¤j¡C
¤p§Ì¹ïpatternªº³]©w¤w¸Ñ¶}¤F¡C
mPtn = "PCE|\d([,}?\d{3}?[.]?\d{0,2})*" |
|
|
|
|
|
|
- ©«¤l
- 1018
- ¥DÃD
- 15
- ºëµØ
- 0
- ¿n¤À
- 1058
- ÂI¦W
- 0
- §@·~¨t²Î
- win7 32bit
- ³nÅ骩¥»
- Office 2016 64-bit
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ®ç¶é
- µù¥U®É¶¡
- 2012-5-9
- ³Ì«áµn¿ý
- 2022-9-28
|
¦^´_ 17# dechiuan999
Áö»¡patternªº³]p¥»¨Ó´N¦³«Ü¦hºØ¡A¦ý§A³o [,} ¥ª¥k¤£¹ïºÙ§Ú´N¬Ý¤£À´¤F¡C
Y¬O¦Ò¼{¤p¼Æ¡A§Ú·|§ï¥Î "PCE|\d+(,\d{3})*(\.\d+)?"
¨ä¹ê³o¥Dnn®Ú¾Ú§A¥i¯àªº¸ê®Æ¦³þ¨Ç§Î¦¡¡A¬Ý§An¦hÄY®æ¤~¯à°÷§ìªº¥¿½T¡A
Y¥i¯àªº¸ê®Æ¦r¦ê¥u¦³§A¼gªº¨º¨Ç§Î¦¡¡A¼eÃPÂI§ì¥Î "PCE|[0-9,.]+" ¬Æ¦Ü¥Î "\S+" ¤]¬O¥i¥Hªº¡C
³Ì¦n¬O¬Ý§Aªº«ä¸ô¡A¥Ñ«e¦Ó«á¡A¹³¤W±n¤Ç°t¤p¼ÆÂI«á¦Ó¥Îªº (\.\d+)?
«Ü®e©ö´N¯à²z¸Ñ¦¨ "¤@Ó¤p¼ÆÂI«á±±µ¤@Ó¥H¤W¼Æ¦r¡A©Î³£¨S¦³"
¥t¥~¦³¨Çpattern¬Oµ¥®Äªº¡A©Ò¥H¼g¥X¨Ópattern¤£¦P¤]¬O¥¿±`ªº
¦p \d µ¥¦P [0-9]
+ µ¥¦P {1,}
* µ¥¦P {0,}
? µ¥¦P {0,1}
\. µ¥¦P [.]
Á`¤§¥ý§¹¥þ²z¸Ñ¦UÓ¯S®í¦r¤¸ªº·N¸q¡A¦A¹³°ï¿n¤ì¤@¼Ë°ï°_¨Ó¡A§Ú¤]¨S¬Æ»ò¯S§Oªº¤èªk¡C |
|
|
|
|
|
|
- ©«¤l
- 231
- ¥DÃD
- 55
- ºëµØ
- 0
- ¿n¤À
- 293
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- KEELUNG
- µù¥U®É¶¡
- 2010-7-24
- ³Ì«áµn¿ý
- 2018-8-28
|
¦^´_ 18# stillfish00
¤j¤j±z¦n¡G
¯uÅý¤j¤j¨£¯º¤F¡A
mPtn = "PCE|\d([,}?\d{3}?[.]?\d{0,2})*"
¹ê¦b¬O¦]¤p§Ì¸Õ¹LµL¼Æ¦¸¡A¤]³£¥¢±Ñ¦¬³õ¡C
¤Ï¦Ó¥´¿ù¤¤¬A¸¹«o¥i¥H逹¦¨¡A¤]¯u¬O©_ÂÝ©O¡H
¤j¤jªº»yªk²©ú§ãn¡A¤]«Ü®e©ö²z¸Ñ¡C
¤p§Ì¤]·PÁ±z¦h¦¸¶}¥Ü¡A¤]Åý¤p§Ì¯à
¦A©¹«eÁÚ¶i¤@¤p¨B¡C
¤é«á¡A¤]§Æ±æ¤j¤j¯à¦h¦h敎»£¤p§Ì¤F¡C
·P®¦¤j¤j¡I |
|
|
|
|
|
|