Regular Expressions 101

Save & Share

  • Regex Version: ver. 4
  • 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

/
/
gm

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#"(?m)(?<="ELE:)\d+(?=":{"isHidden":true})"#).unwrap(); let string = "{\"version\":2,\"(sectionConfig)\":{\"SECT:1236\":{\"children\":{\"ELE:1826\":{\"children\":{\"ELE:4217\":{\"(isHidden)\":true},\"ELE:22043\":{\"isHidden\":true},\"ELE:4253\":{\"isHidden\":true},\"ELE:1796\":{\"isHidden\":true},\"ELE:3907\":{\"isHidden\":true}},\"defaultSelectionId\":\"ELE:1781\"},\"ELE:1850\":{\"defaultSelectionId\":\"ELE:2657\"},\"ELE:1832\":{\"children\":{\"ELE:602\":{\"isHidden\":true},\"ELE:3864\":{\"isHidden\":true},\"ELE:650\":{\"isHidden\":true}},\"defaultSelectionId\":\"ELE:605\"},\"ELE:3711\":{\"isHidden\":true}}},\"SECT:2789\":{\"children\":{\"ELE:3923\":{\"isHidden\":true},\"ELE:3932\":{\"isHidden\":true},\"ELE:3920\":{\"isHidden\":true},\"ELE:3929\":{\"isHidden\":true},\"ELE:3938\":{\"isHidden\":true},\"ELE:3917\":{\"isHidden\":true},\"ELE:3926\":{\"isHidden\":true},\"ELE:3935\":{\"isHidden\":true},\"ELE:2834\":{\"isHidden\":true},\"ELE:2837\":{\"isHidden\":true},\"ELE:2960\":{\"isHidden\":true},\"ELE:2675\":{\"isHidden\":true},\"ELE:2933\":{\"isHidden\":true},\"ELE:2690\":{\"isHidden\":true},\"ELE:2717\":{\"isHidden\":true},\"ELE:3011\":{\"isHidden\":true},\"ELE:2681\":{\"isHidden\":true},\"ELE:2723\":{\"isHidden\":true},\"ELE:2693\":{\"isHidden\":true},\"ELE:2795\":{\"isHidden\":true},\"ELE:3014\":{\"isHidden\":true},\"ELE:2708\":{\"isHidden\":true},\"ELE:2975\":{\"isHidden\":true},\"ELE:2729\":{\"isHidden\":true},\"ELE:2996\":{\"isHidden\":true},\"ELE:2987\":{\"isHidden\":true},\"ELE:2672\":{\"isHidden\":true},\"ELE:2684\":{\"isHidden\":true},\"ELE:2669\":{\"isHidden\":true}}},\"SECT:2531\":{\"children\":{\"ELE:1862\":{\"children\":{\"ELE:26661\":{\"isHidden\":true},\"ELE:26682\":{\"isHidden\":true},\"ELE:26631\":{\"isHidden\":true},\"ELE:26601\":{\"isHidden\":true}},\"defaultSelectionId\":\"ELE:647\"},\"ELE:2690\":{\"isHidden\":true},\"ELE:2637\":{\"isHidden\":true},\"ELE:2485\":{\"isHidden\":true},\"ELE:1832\":{\"children\":{\"ELE:650\":{\"isHidden\":true},\"ELE:602\":{\"isHidden\":true}},\"defaultSelectionId\":\"ELE:605\"},\"ELE:2599\":{\"isHidden\":true},\"ELE:2521\":{\"isHidden\":true},\"ELE:1826\":{\"children\":{\"ELE:27478\":{\"isHidden\":true},\"ELE:27469\":{\"isHidden\":true},\"ELE:27460\":{\"isHidden\":true},\"ELE:27445\":{\"isHidden\":true},\"ELE:27436\":{\"isHidden\":true},\"ELE:27427\":{\"isHidden\":true},\"ELE:1796\":{\"isHidden\":true},\"ELE:4217\":{\"isHidden\":true},\"ELE:22043\":{\"isHidden\":true},\"ELE:27115\":{\"isHidden\":true},\"ELE:3907\":{\"isHidden\":true}},\"defaultSelectionId\":\"ELE:1781\"}}}}} regexEdit tags"; // 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/