Mikrotik: Belajar Regex: Difference between revisions

From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs)
No edit summary
Onnowpurbo (talk | contribs)
No edit summary
Line 1: Line 1:
Sumber: https://mikrotik.tips/understanding-regex-mikrotik-routeros/
Sumber: https://mikrotik.tips/understanding-regex-mikrotik-routeros/


Langkah
==Langkah==
 
* Setup tujuan
* Setup tujuan
* Buat matcher
* Buat matcher
* terjemahkan ke regex
* terjemahkan ke regex


Contoh
==Contoh==
 
* ingin match url yang ada youtube-nya
* ingin match url yang ada youtube-nya
* pattern-nya
* pattern-nya
Line 15: Line 17:
  ^.*youtube.*\.com$
  ^.*youtube.*\.com$
   
   
Keterangan
==Keterangan==
 
  ^  match beginning of the string
  ^  match beginning of the string
  .  match single character
  .  match single character

Revision as of 05:46, 3 October 2020

Sumber: https://mikrotik.tips/understanding-regex-mikrotik-routeros/

Langkah

  • Setup tujuan
  • Buat matcher
  • terjemahkan ke regex

Contoh

  • ingin match url yang ada youtube-nya
  • pattern-nya
 xxx.youtube.xxx
 xxxyoutubexxx.xom
  • regex-nya adalah
^.+\.youtube\..+$
^.*youtube.*\.com$

Keterangan

^  match beginning of the string
.  match single character
+
*
\. untuk mendefinisikan (dot) . bukan (.)
$  match end of string



Referensi