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

/
/
gm

Test String

Code Generator

Generated Code

package main import ( "regexp" "fmt" ) func main() { var re = regexp.MustCompile(`(?m)(\(무\)[\s가-힣A-Za-z0-9\-\(\)\&\.,]{3,}.\))\\x0b`) var str = ` #적용되는 표현식 4nYX5UdJfm(\x01161977P(무) 내Mom같은 어린이보험2104(태아전용,해지환급금미지급형)\x086AAAO-41\n 4nDitK7Uuq\t경북GA본부\x0203(142138\x0126AAAOP(무) 내Mom같은 어린이보험2104(태아전용,해지환급금미지급형)\x0b10022603400\x0203\x0b20017663727\x011(\x010\x0204\x0201\x0124(주)에이플러스에셋어드바이저(동대구)\n 4nY7DiCkOD(\x01161936#(무) 335오!간편건강보험2101\x0b61936-45668\n 4nY79n8YfJ(\x01161963D(무) 메리츠 The간편한건강보험(Ⅱ)2101.2(간편심사형)\x0b61963-12112\n 4nDiqqRgvh\tGA1본부\x0203(82837\x01161963D(무) 메리츠 The간편한건강보험(Ⅱ)2101.2(간편심사형)\x0b20013284310\x0203\x0b10012284737\x011(\x010\x0204\x0201\x0124(주)에이플러스에셋어드바이저(코엑스)\n 4nY6n7I1gO(\x01161879&(무) 내Mom같은 어린이보험2101\x0b61879-28272\n 4nDirG1E0G\tGA2본부\x0203(149470\x01161879&(무) 내Mom같은 어린이보험2101\x0b20006776808\x0203\x0b20017559418\x011(\x010\x0204\x0201\x0121(주)에이플러스에셋어드바이저(서현)\n (\(무\)[\s가-힣A-Za-z0-9\-\(\)\&\.]{3,})\\x0b ==> (\(무\)[\s가-힣A-Za-z0-9\-\(\)\&\.]{3,})\x0b (\(무\)[\s가-힣A-Za-z0-9\-\(\)\&\.]{3,}.\)[z0-9.\(가-힣A-Za-z0-9]{3,}\))\\x0b ==> (\(무\)[\s가-힣A-Za-z0-9\-\(\)\&\.]{3,}.\)[z0-9.\(가-힣A-Za-z0-9]{3,}\))\x0b` 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/