Save & Share

  • Current Version: 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

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)(\$)([^$]+)(\$)`) var str = `\documentclass{article} %\usepackage[T1]{fontenc} %\usepackage{textcomp} %\usepackage[math]{iwona} \usepackage[lf,minionint]{MinionPro} \usepackage{a4,bm} %\usepackage{dotlessj} \pagestyle{empty} \begin{document} \begin{center} {\Large{\bfseries Test of the font {\scshape MinionPro}.}}\bigskip\\ {\Large\verb|\usepackage[lf,minionint]{MinionPro}|} %\medskip\\ %{\verb|\usepackage[romanfamily=bright-osf]{lucimatx}|} if you want old-style figures (like this: \oldstylenums{1695})\\ \end{center} The default math mode font is $Math\ Italic$. This should not be confused with ordinary \emph{Text Italic} -- notice the different spacing\,! \verb|\mathbf| produces bold roman letters: $ \mathbf{abcABC} $. If you wish to embolden complete formulas, use the \verb|\boldmath| command \emph{before} going into math mode. This changes the default math fonts to bold. \begin{tabular}{ll} \texttt{normal} & $ x = 2\pi \Rightarrow x \simeq 6.28 $\\ \texttt{mathbf} & $\mathbf{x} = 2\pi \Rightarrow \mathbf{x} \simeq 6.28 $\\ \texttt{boldmath} & {\boldmath $x = \mathbf{2}\pi \Rightarrow x \simeq{\mathbf{6.28}} $}\\ \end{tabular} \smallskip Greek is available in upper and lower case: $\alpha,\beta \dots \Omega$, and there are special symbols such as $ \hbar$. %The following letters should be upright: $\upGamma, \upDelta\dots \upOmega$. Digits in formulas $1, 2, 3\dots$ may differ from those in text: 1, 2, 3\dots There is a calligraphic alphabet \verb|\mathcal| for upper case letters $ \mathcal{ABCDE}\dots $. %and there are letters for number sets: $\mathbb{A\dots Z} $, which are produced using \verb|\mathbb|. \noindent This font has both lining figures (13589, default) and oldstyle figures (\oldstylenums{13589}, select with {\tt$\backslash$oldstylenums\{..\}}). %{\em \swshape{I}t \swshape{A}lso \swshape{H}as \swshape{S}wash \swshape{I}talics} {\tt$\backslash$swshape\{..\}} \\ {\fontseries{c}\selectfont there is also a condensed weight} {\tt$\backslash$fontseries\{c\}$\backslash$selectfont} \begin{equation} \phi(t)=\frac{1}{\sqrt{2\pi}} \int^t_0 e^{-x^2/2} dx \end{equation} \begin{equation} \prod_{j\geq 0} \left(\sum_{k\geq 0}a_{jk} z^k\right) = \sum_{k\geq 0} z^n \left( \sum_{{k_0,k_1,\ldots\geq 0} \atop{k_0+k_1+\ldots=n} } a{_0k_0}a_{1k_1}\ldots \right) \end{equation} \begin{equation} \pi(n) = \sum_{m=2}^{n} \left\lfloor \left(\sum_{k=1}^{m-1} \lfloor(m/k)/\lceil m/k\rceil \rfloor \right)^{-1} \right\rfloor \end{equation} \begin{equation} \{\underbrace{% \overbrace{\mathstrut a,\ldots,a}^{k\ a's}, \overbrace{\mathstrut b,\ldots,b}^{l\ b's}} _{k+1\ \mathrm{elements}} \} \end{equation} \begin{displaymath} \mbox{W}^+\ \begin{array}{l} \nearrow\raise5pt\hbox{$\mu^+ + \nu_{\mu}$}\\ \rightarrow \pi^+ +\pi^0 \\[5pt] \rightarrow \kappa^+ +\pi^0 \\ \searrow\lower5pt\hbox{$\mathrm{e}^+ +\nu_{\scriptstyle\mathrm{e}}$} \end{array} \end{displaymath} \begin{displaymath} \frac{\pm \left|\begin{array}{ccc} x_1-x_2 & y_1-y_2 & z_1-z_2 \\ l_1 & m_1 & n_1 \\ l_2 & m_2 & n_2 \end{array}\right|}{ \sqrt{\left|\begin{array}{cc}l_1&m_1\\ l_2&m_2\end{array}\right|^2 + \left|\begin{array}{cc}m_1&n_1\\ n_1&l_1\end{array}\right|^2 + \left|\begin{array}{cc}m_2&n_2\\ n_2&l_2\end{array}\right|^2}} \end{displaymath} text accents: \\`{a},\'{a},\"{a},\^{a} may differ from math accents: \begin{displaymath} \mbox{ acute=}\acute{a} \mbox{ grave=}\grave{a} \mbox{ ddot=}\ddot {a} \mbox{ tilde=}\tilde{a} \mbox{ bar=}\bar {a} \mbox{ breve=}\breve{a} \mbox{ check=}\check{a} \mbox{ hat=}\hat {a} \mbox{ vec=}\vec {a} \mbox{ dot=}\dot {a} \end{displaymath} dotlessi=\i\ dotlessj=\j\ dagger=$\dagger$\ \ \ \verb|\bm{x}|\ $\bm{x}$ %$\hbar$ $\hslash$ \end{document} ` 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/