Save & Share

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
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
Processing...

Test String

Code Generator

Generated Code

package main import ( "regexp" "fmt" ) func main() { var re = regexp.MustCompile(`(?m)(?m)^(?:\d\s+|Available:)?(\d+\.\d)(?:\(w\))?\s*(?:Used:)?(\d+\.\d)(?:\(w\))?\s+(?:Remaining:)?(\d+\.\d)(?:\(w\))?`) var str = `shspawn ssh -c aes256-cbc,aes256-ctr -o StrictHostKeyChecking=no -o KexAlgorithms=diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 kulnetpriv@lswitch-kulnet-bur-1 Password: sh powlswitch-kulnet-bur-1#sh pow in Available:124.0(w) Used:31.8(w) Remaining:92.2(w) Interface Admin Oper Power Device Class Max (Watts) --------- ------ ---------- ------- ------------------- ----- ---- Gi0/1 auto off 0.0 n/a n/a 30.0 Gi0/2 auto off 0.0 n/a n/a 30.0 Gi0/3 auto off 0.0 n/a n/a 30.0 Gi0/4 auto off 0.0 n/a n/a 30.0 Gi0/5 auto off 0.0 n/a n/a 30.0 Gi0/6 auto off 0.0 n/a n/a 30.0 Gi0/7 auto on 8.6 Ieee PD 4 30.0 Gi0/8 auto on 23.2 C9120AXI-E 4 30.0 Vlan Root ID Cost Time Age Dly Root Port ---------------- -------------------- --------- ----- --- --- ------------ VLAN0002 4098 7cad.4fc3.fd4f 12 2 20 15 Gi1/0/28 lswitch-11801-0108#sh pow in Module Available Used Remaining (Watts) (Watts) (Watts) ------ --------- -------- --------- 1 195.0 46.2 148.8 Interface Admin Oper Power Device Class Max (Watts) --------- ------ ---------- ------- ------------------- ----- ---- Gi1/0/1 auto off 0.0 n/a n/a 30.0 Gi1/0/2 auto on 15.4 Ieee PD 0 30.0 Gi1/0/3 auto on 15.4 Ieee PD 0 30.0 Gi1/0/4 auto on 15.4 Ieee PD 3 30.0 Gi1/0/5 auto off 0.0 n/a n/a 30.0 Gi1/0/6 auto off 0.0 n/a n/a 30.0 Gi1/0/7 auto off 0.0 n/a n/a 30.0 Gi1/0/8 auto off 0.0 n/a n/a 30.0 Gi1/0/9 auto off 0.0 n/a n/a 30.0 Gi1/0/10 auto off 0.0 n/a n/a 30.0 Gi1/0/11 auto off 0.0 n/a n/a 30.0 Gi1/0/12 auto off 0.0 n/a n/a 30.0 Gi1/0/13 auto off 0.0 n/a n/a 30.0 Gi1/0/14 auto off 0.0 n/a n/a 30.0 Gi1/0/15 auto off 0.0 n/a n/a 30.0 Gi1/0/16 auto off 0.0 n/a n/a 30.0 Gi1/0/17 auto off 0.0 n/a n/a 30.0 Gi1/0/18 auto off 0.0 n/a n/a 30.0 Gi1/0/19 auto off 0.0 n/a n/a 30.0 Gi1/0/20 auto off 0.0 n/a n/a 30.0 Gi1/0/21 auto off 0.0 n/a n/a 30.0 Gi1/0/22 auto off 0.0 n/a n/a 30.0 Gi1/0/23 auto off 0.0 n/a n/a 30.0 Gi1/0/24 auto off 0.0 n/a n/a 30.0 ` for i, match := range re.FindAllString(str, -1) { fmt.Println(match, "found at index", i) } }

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 Golang, please visit: https://golang.org/pkg/regexp/