Tuesday, August 8, 2017

Belajar RegEx (Regular Expression)

Menyambung tulisan saya disini dan disini ada beberapa syntax yang saya pakai, berikut adalah penjelasannya :

. --> apapun
[0-9] => 0-9  => \d
[a-z] => a-z
\w+ ==> [0-9] &/ [a-z]

\d -> 0,1,2,3,4,5,6,7,8,9
\d+ -> 01 02 12343354 4545246 459797 43434
\d* -> 

.+
.*

.+? ==> 

$abcd@$dfajdffjl@$dfadfjfdl@

[$].+[@]
[$].+?[@]

^ ---> awal line
[^a] --> negasi/apapun yang tidak a

\s --> space --> space / cr / return / nl


     1  20103008460         VINCENT WIJAIDRAYA    IDR            410,000.00  01/03/16  12:02:51  67611  -                -               
     2  20103008463         AMELIA MEISY SID  IDR            820,000.00  01/03/16  11:29:54  00000  US BLN MARET -   APRIL 2016      
     3  20103008632         YOSUA PURBA       IDR            730,000.00  01/03/16  13:03:41  00000  U SKLAH MARETY   16              
     4  20103008888         XENA LEVINA SILA  IDR            410,000.00  01/03/16  16:11:21  95031  Uang sekolah xe  Maret 2016      

^\s+\d+\s+\d+.+?IDR\s+[\d,.]+\s+\d+\/\d+\/\d+\s+\d+:\d+:\d+\s+\d+.*
regex

2 Beri Komentar: