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

# coding=utf8 # the above tag defines encoding for this document and is for Python 2.x compatibility import re regex = r""" Safari infiltrator.v.1.2.2 """ test_str = ("Safari with Infiltrator.v.1.2.2\n" "by superkiller~<.\\$~superkiller$.temp~>\n" "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);\n" "{[(<9653778993:#Safari.(\"<(-_-)>~,.!.,[infiltrator.v1.2.2 by superkiller];}])>~#22FF85#\n" "// Hent alle links fra siden\n" "var elements = document.querySelectorAll(\"a\");\n" "for (let element of elements) {\n" " result.push({\n" " \"url\": element.href,\n" " \"text\": element.innerText\n" "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\";\n" "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\\.\n" "WDGF\\/.@!@SNA@!@.\\/:\"1\":024542568999865245420:.aa\\999/aa.:024542568999865245420:\n" "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~\";\n" "var return \"$~superkiller$.temp~\"\n" "if return \"$~superkiller$.temp~\"\n" "return \"$~superkiller$.temp~\"\n" "var \"stay\" if \"stay\" do \"stay\":(:re:):\n" "// Safari Infiltrator.v.1.2.2 by superkiller\n" "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?(););\n" " });\n" "}\n\n" "// Kald completion for at slutte\n" "completion(result);") matches = re.finditer(regex, test_str, re.IGNORECASE | re.VERBOSE | re.DOTALL | re.UNICODE | re.MULTILINE) for matchNum, match in enumerate(matches, start=1): print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group())) for groupNum in range(0, len(match.groups())): groupNum = groupNum + 1 print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum))) # Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.

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 Python, please visit: https://docs.python.org/3/library/re.html