Regular Expressions 101

Save & Manage Regex

  • Current Version: 2
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
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
  • 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
Processing...

Test String

Code Generator

Generated Code

re = /[\x{0200}-\x{FFFF}]/mi str = '[11:51] <Lucas807> ๐•œ๐—ˆ๐”จ๐—ผ;๐˜จ๐—ด ๐”ข๐šœ๐“‰ ๐“ญษช๐•ค๐”ญ๐š˜ ๐˜ด๐•ฆ๐“‡ ๐–ˆ๐–”๐•”๐–”๐•˜ส€๐•’๐–’.๐–‹๐•ฃ [11:51] <Lucas807> ๐š”๐š˜๐“ด๐—ผ;๐‘”๐—€ ๐šŽ๐˜ด๐“‰ แด…๐‘–๐•ค๐•กแด ๐—Œ๐˜ถ๐”ฏ ๐‘แด๐•”๐˜ฐ๐˜จ๐”ฏ๐–บแด.๐”ฃ๐š› [11:49] <Damien537> ๐“ด๐“ธ๐“ด๐‘œ;๐—ด๐‘” ๐•–๐—Œ๐”ฑ ๐’น๐‘–๐”ฐ๐š™๐“ธ s๐“Š๐•ฃ ๐–ˆ๐—ˆ๐–ผ๐‘œ๐‘”๐“‡๐—ฎ๐“ถ.า“๐•ฃ [11:49] <Damien537> ๐‘˜๐”ฌ๐“ด๐š˜;๐˜จ๐“ฐ ๐˜ฆ๐”ฐ๐“‰ ๐”ก๐—‚๐—Œ๐š™๐–” ๐–˜๐˜‚๐•ฃ ๐˜ค๐“ธ๐’ธ๐”ฌ๐‘”๐•ฃ๐—ฎ๐—†.๐”ฃ๐•ฃ [11:48] <Axel937> ๐˜ฌ๐‘œ๐—„๐š˜;ษข๐”ค ๐“ฎ๐šœ๐š ๐—ฑ๐‘–๐•ค๐š™๐š˜ ๐šœ๐˜ถ๐‘Ÿ ๐‘๐”ฌ๐’ธ๐š˜๐˜จ๐˜ณ๐“ช๐”ช.๐“ฏ๐—ฟ [11:48] <Axel937> ๐“ด๐• ๐–๐–”;๐•˜๐—ด ๐“ฎ๐”ฐ๐“‰ ๐”ก๐š’๐˜€๐“นแด ๐˜ด๐˜ถ๐–— ๐–ผแด๐‘๐‘œ๐‘”๐–—แด€๐—†.า“ส€ [11:46] <Leon231> ๐“ด๐—ˆ๐—ธ๐‘œ;๐‘”๐š ๐˜ฆ๐˜€๐“ฝ ๐š๐–Ž๐“ผ๐”ญ๐˜ฐ ๐”ฐ๐–š๐—ฟ แด„๐˜ฐ๐” ๐—ผ๐—ด๐‘Ÿ๐—ฎ๐“‚.๐’ป๐š› [11:46] <Leon231> ๐š”๐“ธ๐˜ฌ๐“ธ;๐—€๐“ฐ ๐–พ๐“ผ๐˜ ๐”ก๐•š๐˜€๐“น๐—ˆ ๐“ผ๐“พ๐˜ณ ๐’ธ๐–”๐—ฐแด๐‘”๐“‡๐—ฎ๐•ž.๐•—๐—ฟ [11:44] <Maxime678> ๐—ธ๐š˜๐”จ๐• ;๐‘”๐š ๐”ข๐“ˆ๐— แด…๐“ฒ๐•ค๐‘๐“ธ s๐“Š๐–— ๐’ธ๐š˜๐–ˆ๐š˜๐—ด๐—‹๐’ถแด.๐š๐–— [11:44] <Maxime678> ๐”จ๐‘œ๐•œ๐˜ฐ;๐”ค๐—ด แด‡๐—Œ๐— ๐˜ฅ๐—‚๐“ผ๐‘๐•  ๐šœ๐—Ž๐”ฏ ๐” ๐š˜๐‘๐“ธ๐“ฐ๐“ป๐‘Žแด.๐“ฏ๐š› [11:43] <Hugo645> ๐š”๐• ๐•œ๐”ฌ;๐‘”๐š ๐‘’s๐•ฅ ๐–ฝ๐‘–๐˜€๐š™๐š˜ ๐“ˆ๐–š๐—‹ ๐‘แดแด„๐‘œ๐—ด๐š›๐”ž๐˜ฎ.า“๐—‹ [11:43] <Hugo645> ๐”จ๐—ผ๐—ธ๐—ผ;๐š๐˜จ ๐”ข๐“ˆ๐“ฝ ๐šษช๐”ฐแด˜๐—ˆ ๐˜€๐‘ข๐–— ๐‘๐—ผ๐šŒ๐—ˆ๐•˜๐š›๐•’๐š–.๐•—๐š› [11:41] <Tristan549> ๐•œแด๐—„๐–”;๐‘”๐“ฐ ๐–Š๐”ฐ๐“‰ ๐‘‘๐•š๐šœ๐“…๐—ผ ๐”ฐ๐˜‚๐“ป ๐—ฐแด๐’ธ๐—ˆ๐–Œ๐–—๐šŠ๐—บ.๐”ฃ๐•ฃ [11:41] <Tristan549> ๐—„๐—ผ๐š”๐‘œ;ษข๐•˜ ๐•–๐˜ด๐š แด…๐—‚๐•ค๐‘๐•  ๐‘ ๐“พส€ ๐•”๐—ˆ๐’ธ๐—ผ๐‘”๐“ป๐“ช๐—บ.๐š๐—‹ Test sans caractรจres bizarres Et ๐“ชv๐•–c' # Print the match result str.scan(re) do |match| puts match.to_s end

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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html