Regular Expressions 101

Save & Share

  • Regex Version: ver. 87
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
igm

Test String

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"^FB\-(.*) Facebook tüm arkadaşlarınızla"; string input = @"--b1_7c33580701799b858d1ab7d78f876b33 Content-Type: text/plain; charset=""UTF-8"" Content-Transfer-Encoding: quoted-printable ======================================== Hesabınızı Onaylayın https://www.facebook.com/n/?confirmemail.php&e=ezgiaktas65523%40yandex.com&c=90430&cuid=AYg8uAvR_v-5IscpmGkQTZhaG1EPhI8Y5GtW1JV-yZuIAOk-NiUOuXy07pvpNCqTzaXAB0dPssMGkOyM1NXVnfKGZ8D62Y_14iBmqh_Gb3EX0VrFwlm3vb6IjP5b13QKlwY&aref=1642527518851633&medium=email&mid=5d5de73b57f5fG5b050c997118G5d5debd4b8231G3c2&n_m=ezgiaktas65523%40yandex.com ======================================== Merhaba Ezgi, Merhaba Ezgi, Yakın zamanda Facebook'a kaydoldunuz. Facebook kaydınızı tamamlamak için lütfen hesabınızı onaylayın. Teşekkürler, Facebook ekibi Şu onay kodunu girmeniz istenebilir: FB-90430 Facebook tüm arkadaşlarınızla iletişim kurmanıza ve iletişimde kalmanıza yardımcı olur. Facebook'a katıldıktan sonra fotoğraflar paylaşabilir, etkinlikler planlayabilir ve daha fazlasını yapabilirsiniz. ======================================== İsteğiniz üzerine bu mesaj ezgiaktas65523@yandex.com adresine gönderilmiştir. Meta Platforms, Inc., Attention: Community Support, 1 Facebook Way, Menlo Park, CA 94025 Hesabınızı güvende tutabilmek için lütfen bu e-postayı iletmeyin. Daha fazla bilgi almak için aşağıdaki bağlantıya tıklayın. https://www.facebook.com/email_forward_notice/?mid=5d5de73b57f5fG5b050c997118G5d5debd4b8231G3c2 --b1_7c33580701799b858d1ab7d78f876b33 Content-Type: text/html; charset=""UTF-8"" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional //EN""><html><head><title>Facebook</title><meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" /><style nonce=""O2FMxb3p"">@media all and (max-width: 480px){*[class].ib_t{min-width:100% !important}*[class].ib_row{display:block !important}*[class].ib_ext{display:block !important;padding:10px 0 5px 0;vertical-align:top !important;width:100% !important}*[class].ib_img,*[class].ib_mid{vertical-align:top !important}*[class].mb_blk{display:block !important;padding-bottom:10px;width:100% !important}*[class].mb_hide{display:none !important}*[class].mb_inl{display:inline !important}*[class].d_mb_flex{display:block !important}}.d_mb_show{display:none}.d_mb_flex{display:flex}@media only screen and (max-device-width: 480px){.d_mb_hide{display:none !important}.d_mb_show{display:block !important}.d_mb_flex{display:block !important}}.mb_text h1,.mb_text h2,.mb_text h3,.mb_text h4,.mb_text h5,.mb_text h6{line-height:normal}.mb_work_text h1{font-size:18px;line-height:normal;margin-top:4px}.mb_work_text h2,.mb_work_text h3{font-size:16px;line-height:normal;margin-top:4px}.mb_work_text h4,.mb_work_text h5,.mb_work_text h6{font-size:14px;line-height:normal}.mb_work_text a{color:#1270e9}.mb_work_text p{margin-top:4px}</style></head><body style=""margin:0;padding:0;"" dir=""ltr"" bgcolor=""#ffffff""><table border=""0"" cellspacing=""0"" cellpadding=""0"" align=""center"" id=""email_table"" style=""border-collapse:collapse;""><tr><td id=""email_content"" style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;background:#ffffff;""><table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" style=""border-collapse:collapse;""><tr style=""><td height=""20"" style=""line-height:20px;"" colspan=""3"">&nbsp;</td></tr><tr><td height=""1"" colspan=""3"" style=""line-height:1px;""><span style=""color:#FFFFFF;font-size:1px;opacity:0;""> Merhaba Ezgi, Yakın zamanda Facebook&#039;a kaydoldunuz. Facebook kaydınızı tamamlamak için lütfen hesabınızı onaylayın. </span></td></tr><tr><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td><td style=""><table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" style=""border-collapse:collapse;""><tr style=""><td height=""15"" style=""line-height:15px;"" colspan=""3"">&nbsp;</td></tr><tr><td width=""32"" align=""left"" valign=""middle"" style=""height:32;line-height:0px;""><a href=""https://www.facebook.com/n/?confirmemail.php&amp;e=ezgiaktas65523%40yandex.com&amp;c=90430&amp;cuid=AYi4LuOy_ckOKC3zv727NlHC4n3RHSVRSuELgJFpM3cd5wOLDrjkgOLoFHhhX2kHE6Ja11nj2zM8ZY_lyF3vj5YimJpGk0OmQUxoHDrzg7rm8jLHpHoIVIsYgxeuDEOPiPo&amp;aref=1642527518851633&amp;medium=email&amp;mid=5d5de73b57f5fG5b050c997118G5d5debd4b8231G3c2&amp;n_m=ezgiaktas65523%40yandex.com"" style=""color:#3b5998;text-decoration:none;""><img src=""https://static.xx.fbcdn.net/rsrc.php/v3/yP/r/nblMrq1jYuK.png"" width=""32"" height=""32"" style=""border:0;"" /></a></td><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td><td width=""100%"" style=""><a href=""https://www.facebook.com/n/?confirmemail.php&amp;e=ezgiaktas65523%40yandex.com&amp;c=90430&amp;cuid=AYi4LuOy_ckOKC3zv727NlHC4n3RHSVRSuELgJFpM3cd5wOLDrjkgOLoFHhhX2kHE6Ja11nj2zM8ZY_lyF3vj5YimJpGk0OmQUxoHDrzg7rm8jLHpHoIVIsYgxeuDEOPiPo&amp;aref=1642527518851633&amp;medium=email&amp;mid=5d5de73b57f5fG5b050c997118G5d5debd4b8231G3c2&amp;n_m=ezgiaktas65523%40yandex.com"" style=""color:#3b5998;text-decoration:none;font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:19px;line-height:32px;"">İşlem Gerekiyor: Facebook Hesabınızı Onaylayın</a></td></tr><tr style=""border-bottom:solid 1px #e5e5e5;""><td height=""15"" style=""line-height:15px;"" colspan=""3"">&nbsp;</td></tr></table></td><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td></tr><tr><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td><td style=""><table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" style=""border-collapse:collapse;""><tr style=""><td height=""28"" style=""line-height:28px;"">&nbsp;</td></tr><tr><td style=""><span class=""mb_text"" style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:16px;line-height:21px;color:#141823;"">Merhaba Ezgi,</span></td></tr><tr style=""><td height=""28"" style=""line-height:28px;"">&nbsp;</td></tr><tr><td style=""><span class=""mb_text"" style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:16px;line-height:21px;color:#141823;"">Yakın zamanda Facebook&#039;a kaydoldunuz. Facebook kaydınızı tamamlamak için lütfen hesabınızı onaylayın.</span></td></tr><tr style=""><td height=""28"" style=""line-height:28px;"">&nbsp;</td></tr></table></td><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td></tr><tr><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td><td style=""><table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" style=""border-collapse:collapse;""><tr style=""><td height=""2"" style=""line-height:2px;"" colspan=""3"">&nbsp;</td></tr><tr><td class=""mb_blk"" style=""><a href=""https://www.facebook.com/n/?confirmemail.php&amp;e=ezgiaktas65523%40yandex.com&amp;c=90430&amp;cuid=AYg0xJuCFwQ3yz6hC7VX8E7ZbfHFvrpgsPhC-qSCK0HaZRGZY0HTI4G9Uj1E2_nHluClUBZVVrcjQkSl7aOi6kP6HnTXI2WZa81c0HcbtpCg5S2UcHQp8EctLRGt0D-56tg&amp;aref=1642527518851633&amp;medium=email&amp;mid=5d5de73b57f5fG5b050c997118G5d5debd4b8231G3c2&amp;n_m=ezgiaktas65523%40yandex.com"" style=""color:#3b5998;text-decoration:none;""><table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" style=""border-collapse:collapse;""><tr><td style=""border-collapse:collapse;border-radius:2px;text-align:center;display:block;border:solid 1px #344c80;box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.1),0 1px 0 rgba(0, 0, 0, 0.1);background:#4c649b;padding:7px 16px 11px 16px;""><a href=""https://www.facebook.com/n/?confirmemail.php&amp;e=ezgiaktas65523%40yandex.com&amp;c=90430&amp;cuid=AYg0xJuCFwQ3yz6hC7VX8E7ZbfHFvrpgsPhC-qSCK0HaZRGZY0HTI4G9Uj1E2_nHluClUBZVVrcjQkSl7aOi6kP6HnTXI2WZa81c0HcbtpCg5S2UcHQp8EctLRGt0D-56tg&amp;aref=1642527518851633&amp;medium=email&amp;mid=5d5de73b57f5fG5b050c997118G5d5debd4b8231G3c2&amp;n_m=ezgiaktas65523%40yandex.com"" style=""color:#3b5998;text-decoration:none;display:block;""><center><font size=""3""><span style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;white-space:nowrap;font-weight:bold;vertical-align:middle;color:#ffffff;text-shadow:0 -1px 0 #415686;font-size:14px;line-height:14px;"">Hesabınızı&nbsp;Onaylayın</span></font></center></a></td></tr></table></a></td><td width=""100%"" class=""mb_hide"" style=""></td></tr><tr style=""><td height=""32"" style=""line-height:32px;"" colspan=""3"">&nbsp;</td></tr></table></td><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td></tr><tr><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td><td style=""><table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" style=""border-collapse:collapse;""><tr><td style=""><span class=""mb_text"" style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:16px;line-height:21px;color:#141823;"">Şu onay kodunu girmeniz istenebilir:</span></td></tr><tr style=""><td height=""14"" style=""line-height:14px;"">&nbsp;</td></tr><tr><td style=""><span class=""mb_text"" style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:16px;line-height:21px;color:#141823;""><center><table border=""0"" cellspacing=""0"" cellpadding=""0"" style=""border-collapse:collapse;""><tr><td style=""font-size:11px;font-family:LucidaGrande,tahoma,verdana,arial,sans-serif;padding:10px;background-color:#f2f2f2;border-left:1px solid #ccc;border-right:1px solid #ccc;border-top:1px solid #ccc;border-bottom:1px solid #ccc;"">FB-90430</td></tr></table></center></span></td></tr><tr style=""><td height=""14"" style=""line-height:14px;"">&nbsp;</td></tr><tr><td style=""><span class=""mb_text"" style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:14px;line-height:19px;color:#898f9c;"">Facebook tüm arkadaşlarınızla iletişim kurmanıza ve iletişimde kalmanıza yardımcı olur. Facebook&#039;a katıldıktan sonra fotoğraflar paylaşabilir, etkinlikler planlayabilir ve daha fazlasını yapabilirsiniz.</span></td></tr><tr style=""><td height=""14"" style=""line-height:14px;"">&nbsp;</td></tr></table></td><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td></tr><tr><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td><td style=""><table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" align=""left"" style=""border-collapse:collapse;""><tr style=""border-top:solid 1px #e5e5e5;""><td height=""19"" style=""line-height:19px;"">&nbsp;</td></tr><tr><td style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:11px;color:#aaaaaa;line-height:16px;"">İsteğiniz üzerine bu mesaj <a href=""mailto:ezgiaktas65523&#064;yandex.com"" style=""color:#3b5998;text-decoration:none;"">ezgiaktas65523&#064;yandex.com</a> adresine gönderilmiştir.<br />Meta Platforms, Inc., Attention: Community Support, 1 Facebook Way, Menlo Park, CA 94025</td></tr></table></td><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td></tr><tr><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td><td style=""><table border=""0"" width=""100%"" cellspacing=""0"" cellpadding=""0"" style=""border-collapse:collapse;""><tr><td style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:11px;color:#aaaaaa;line-height:16px;""><span class=""mb_text"" style=""font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:16px;line-height:21px;color:#141823;;font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;font-size:11px;color:#aaaaaa;line-height:16px;"">Hesabınızı güvende tutabilmek için lütfen bu e-postayı iletmeyin. <a style=""color:#3b5998;text-decoration:none;"" href=""https://www.facebook.com/email_forward_notice/?mid=5d5de73b57f5fG5b050c997118G5d5debd4b8231G3c2"">Daha Fazla Bilgi Alın</a></span></td></tr></table></td><td width=""15"" style=""display:block;width:15px;"">&nbsp;&nbsp;&nbsp;</td></tr><tr style=""><td height=""20"" style=""line-height:20px;"" colspan=""3"">&nbsp;</td></tr></table><span style=""><img src=""https://www.facebook.com/email_open_log_pic.php?cn=DHOpBllDo3&amp;mid=5d5de73b57f5fG5b050c997118G5d5debd4b8231G3c2"" style=""border:0;width:1px;height:1px;"" /></span></td></tr></table></body></html> --b1_7c33580701799b858d1ab7d78f876b33--"; RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Multiline; foreach (Match m in Regex.Matches(input, pattern, options)) { Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index); } } }

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx