Regular Expressions 101

Save & Share

  • Save new Regex
    ctrl+s
  • Update 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
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
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • 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

/
/
gm

Test String

Code Generator

Generated Code

$re = '/^#EXTINF:-1,(.*)\n(.*)$/m'; $str = '#EXTINF:-1,Seba Jr Vallo - Exit [Allright Sound] httpspsv4/c813131/u185959662/audios/81cf2c85b94f.mp3?extra=0XXqDUBh12JQIRpGPTLH3n9_kSIyCpLstXwgaCb4XYaH2lalB3ApQ07ZLfcWPKsMVX8GARyGAro99s7WPuZuI6uNW42bGKM11l9F_3eZ2aJucmZ6d4F0kz96tNEWTIlP6AMP_89hHir7-KTSRwgOUjQ #EXTINF:-1,Мотивация - Ты готов (SportFaza) httpss1-38v4.ot/p7/fe281a574c01d4.mp3?extra=v0fBEZiZGp6DPLjIfhXicU3XKDixxd_JvW0eUjThp9wgqvP-behc92lTc-48IcFMpsA2XZ9DdOtfjaVmMG8y68JaLxJI_BTsAjag6k3OH0ylOv9R_FJY75vljyuujaaaauWbJwtfKto1bS9ZXGAhfCQ #EXTINF:-1,Мотивация Спорта.Sports Motivation 2015 - Мотивация Спорта.Sports Motivation 2015 httpscs1-66v4.udioet/p1/e51d018fd8dd81.mp3?extra=b6SYUV_7IiUeoT_YwagCc3gt0JWYEeTngTpO0z_y-sd5nabObJ8tQEjZhJ9U-bwdMuu7xmU_SgopoD9Lg7hAugiRc7rDRvGNCKYyngHzpF1AYrEhCAkc5VO2WldglXuP_rnbuCsSkYY9HnpvGgLshr4 #EXTINF:-1,POD - POD - 13 - Boom httpscs1-74v4.audio./p15/f71c58a21dc2e6.mp3?extra=rXjXdFb5TlXNf-SHVzmBrof_wrN2yC6JZSruaCYnEpYNwfJ7ydeiZJ4R_FyttTpkCRoD73BY4aNzSE_6FlF0oL99i7_ePGarFhysDCmaspLnUezERSXhY46r4TgrUYkQvPUGCH5pYJq8rGLu2Vj1pnc #EXTINF:-1,Basic Biology - Twilight (feat. Megan McKay) httpscs1-65v4.dio.t/p16/274bb296805a32.mp3?extra=c2W_1xBj_u0j0SoLwtFK9m43W8aEaxKa2iURJbq6avrsv7sji8DI0gvHZVXBNIjEoSYdOYh2dR_9AbdCPuVh-EacpuQ4NU19lgsFLwb2BDndDyh5zOiS2fXo-7xiFE8rBP92LT4nBbnclA9nsuwdppE #EXTINF:-1,Seba & Jr Vallo - -15 httpspsv4.eraudio.t/c815121/u318907484/audios/01ba83bd4be8.mp3?extra=8I3IOtJnbqF_js0iTnO03WC43uG2SludNdphzkkAxDm_Ww-LiTgs-IOpJEtD6hyIcro1OfpR9yZ36hCwb7PwVHstblFeG-nUcHsm5wvy32MErVKa0qNnpSa_fQHyzudBuX158n_961bzRK-ddGv9Fd8'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches);

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php