Regular Expressions 101

Save & Share

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

/
/
gixXsuUAJDm

Test String

Code Generator

Generated Code

// include the latest version of the regex crate in your Cargo.toml extern crate regex; use regex::Regex; fn main() { let regex = Regex::new(r"(?ixsuUm)Safari infiltrator.v.1.2.2").unwrap(); let string = "Safari with Infiltrator.v.1.2.2 by superkiller~<.\\$~superkiller$.temp~> var result = [get,.url,.get,.add,.url,.get,.url:.aa\\?.\\$~superkiller$.temp~\\:\\:C:\\Users\\$~superkiller$.temp~\\Safari = [get,add,url, var = get, add, url, get, url, add url]}{|}{:~<.n#0123456789998876521353124542125666666.nh:{[(<h:.aa\\?.? var = <963>:.aa\\?.>]}{|}{:get,add,url>]}: if get; var = url; if add, get, var = get(url); {[(<9653778993:#Safari.(\"<(-_-)>~,.!.,[infiltrator.v1.2.2 by superkiller];}])>~#22FF85# // Hent alle links fra siden var elements = document.querySelectorAll(\"a\"); for (let element of elements) { result.push({ \"url\": element.href, \"text\": element.innerText var result = [\"%.-2*%#!%*-.x=-~(x.=.-100.25:159.75:300.75:385.11:534.43:902.25:1540.44:2706.75.-~=C:\\Users\\$~superkiller$\\desktop\\$~superkiller$.temp~.txt)\"];let if :45:1.id_TOKEN_WDGF.accept.45:55.C:\\Users\\$~superkiller$.temp~\\id_token.txt\" if var \"results\"; in \"var 45:55.WDGF.id.TOKEN.txt\"; if \"result\"; \"denied\";'try' if do; \"allow\"; if \"results\" = \"ping\";\"ACCESS_TOKEN:re:token;by it as to re 'old' by bind::(.2).new,.:45.! 'old' to use \"45\":45.:(:re:):.aa\\. WDGF\\/.@!@SNA@!@.\\/:\"1\":024542568999865245420:.aa\\999/aa.:024542568999865245420: var results = \"55\"; do, if, var \"45.55\":*:\"if: = \"id_TOKEN. do\" :55:45.55:222222.-:*:-.2/}{|}{:(.2>:(\"id.45:55:43.?...:34.42.55:45:55\") if = \"$~superkiller$.temp~\"; var if \"show\" = \"$~superkiller$.temp~\" if \"access\" = \"only show\" = \"$~superkiller$.temp~\" if \"_id_:(:re:):$~superkiller$.temp~\"; var return \"$~superkiller$.temp~\" if return \"$~superkiller$.temp~\" return \"$~superkiller$.temp~\" var \"stay\" if \"stay\" do \"stay\":(:re:): // Safari Infiltrator.v.1.2.2 by superkiller var get:.\\aa?.:a:a:o:a#a:o:a:a var = \"id_token\":45 for WDGF_token.id.WDGF: if \"45\"; re :token_access = \"previous\" on \"connnect\" re-use \"id_token\" var \"TOKEN_ACCESS\" if \"id\" is \"allow\" do \"use\" or if var return \"id_token\" for \"accept\" or if as id_token = \"allow\" (test and work in progress); to use previous connected to hop token var = (token);if?:(token);var = \"new\"(var = id.token);if:(\"lost\");var = \"new\"(get);var token(WDGF.n#9);var .n#6(get,add,token);var get,token,var add,token(\".n#678999887666666\");var .n#->~>=>[lost?(token);get,token(var = token);var add,token();var token();var used?:.aa\\?.url();if token();var token();get token(); if token();var fetch(if do use new but ut can is if go on re is old by switch to this new?();); }); } // Kald completion for at slutte completion(result);"; // result will be an iterator over tuples containing the start and end indices for each match in the string let result = regex.captures_iter(string); for mat in result { println!("{:?}", mat); } }

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 Rust, please visit: https://docs.rs/regex/latest/regex/