Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • 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)(00" : )(?!(?s:.*)(00" : ))(.*)"#).unwrap(); let string = " \"Values\" : { \"16800\" : 0, \"17100\" : 0, \"17400\" : 0, \"17700\" : 0, \"18000\" : 0, \"18300\" : 0, \"18600\" : 0, \"18900\" : 0, \"19200\" : 0, \"19500\" : 0, \"19800\" : 0, \"20100\" : 0.029999999999999999, \"20400\" : 0.040000000000000001, \"20700\" : 0.059999999999999998, \"21000\" : 0.080000000000000002, \"21300\" : 0.10000000000000001, \"21600\" : 0.14000000000000001, \"21900\" : 0.19, \"22200\" : 0.22, \"22500\" : 0.23999999999999999, \"22800\" : 0.25, \"23100\" : 0.25, \"23400\" : 0.27000000000000002, \"23700\" : 0.28000000000000003, \"24000\" : 0.28999999999999998, \"24300\" : 0.33000000000000002, \"24600\" : 0.35000000000000003, \"24900\" : 0.39000000000000001, \"25200\" : 0.41999999999999998, \"25500\" : 0.47999999999999998, \"25800\" : 0.5, \"26100\" : 0.52000000000000002, \"26400\" : 0.54000000000000004, \"26700\" : 0.55000000000000004, \"27000\" : 0.57000000000000006, \"27300\" : 0.57999999999999996, \"27600\" : 0.59999999999999998, \"27900\" : 0.62, \"28200\" : 0.64000000000000001, \"28500\" : 0.66000000000000003, \"28800\" : 0.67000000000000004, \"29100\" : 0.69000000000000006, \"29400\" : 0.70999999999999996, \"29700\" : 0.75, \"30000\" : 0.79000000000000004, \"30300\" : 0.81000000000000005, \"30600\" : 0.83000000000000007, \"30900\" : 0.85999999999999999, \"31200\" : 0.91000000000000003, \"31500\" : 1.01, \"31800\" : 1.27, \"32100\" : 1.3600000000000001, \"32400\" : 1.3, \"32700\" : 1.3, \"33000\" : 1.76, \"33300\" : 1.8100000000000001, \"33600\" : 1.78, \"33900\" : 1.97, \"34200\" : 2.0499999999999998, \"34500\" : 2.0800000000000001, \"34800\" : 2.6699999999999999, \"35100\" : 2.8399999999999999, \"35400\" : 2.7600000000000002, \"35700\" : 3.0800000000000001, \"36000\" : 3.3999999999999999, \"36300\" : 3.6600000000000001, \"36600\" : 3.8500000000000001, \"36900\" : 4.04, \"37200\" : 4.25, \"37500\" : 4.46, \"37800\" : 4.7000000000000002, \"38100\" : 5.0600000000000005, \"38400\" : 5.6000000000000005, \"38700\" : 6.2999999999999998, \"39000\" : 6.3500000000000005, \"39300\" : 6.9000000000000004, \"39600\" : 7.5600000000000005, \"39900\" : 6.2000000000000002, \"40200\" : 3.0300000000000002, \"40500\" : 4.0700000000000003, \"40800\" : 3.3100000000000001, \"41100\" : 7.1799999999999997, \"41400\" : 8.2200000000000006, \"41700\" : 8.1099999999999994, \"42000\" : 8.2699999999999996, \"42300\" : 8.6699999999999999, \"42600\" : 8.9700000000000006, \"42900\" : 8.8900000000000006, \"43200\" : 8.9399999999999995, \"43500\" : 8.7599999999999998, \"43800\" : 9.2000000000000011, \"44100\" : 9.1400000000000006, \"44400\" : 8.8200000000000003, \"44700\" : 9.4600000000000009, \"45000\" : 9.5099999999999998, \"45300\" : 9.4600000000000009, \"45600\" : 7.8500000000000005, \"45900\" : 2.6899999999999999, \"46200\" : 9.6400000000000006, \"46500\" : 9.8900000000000006, \"46800\" : 10.01, \"47100\" : 10.040000000000001, \"47400\" : 10.210000000000001, \"47700\" : 10.25, \"48000\" : 10.550000000000001, \"48300\" : 10.630000000000001, \"48600\" : 10.67, \"48900\" : 10.35, \"49200\" : 6 }"; // 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/