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 15: Line 15:
  ^.*youtube.*\.com$
  ^.*youtube.*\.com$
   
   
Keterangan
Keterangan
  ^  match beginning of the string
 
  .  match single character
^  match beginning of the string
  +
.  match single character
  \. untuk mendefinisikan (dot) . bukan (.)
+
  $  match end of string
*
\. untuk mendefinisikan (dot) . bukan (.)
$  match end of string





Revision as of 04:45, 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