Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • Save & Share
  • 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
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

#include <StringConstants.au3> ; to declare the Constants of StringRegExp #include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate Local $sRegex = "Seat (?P<playerseat>[0-9]+): (?P<playername>[.?]+)" Local $sString = "he name of first value, first 17/04/2013 11:30:00 - A:30.0" & @CRLF & _ "" & @CRLF & _ "PokerStars Hand #152844641611: Tournament #1556870024, $0.44+$0.44+$0.12 USD Hold'em No Limit - Level I (25/50) - 2016/05/04 13:15:07 BRT [2016/05/04 12:15:07 ET]" & @CRLF & _ "Table '1556870024 3' 6-max Seat #1 is the button" & @CRLF & _ "Seat 1: vitalijus (500 in chips) " & @CRLF & _ "Seat 2: papoca555 (500 in chips) " & @CRLF & _ "Seat 3: SITBACKNOW (500 in chips) " & @CRLF & _ "Seat 4: hackerpex (500 in chips) " & @CRLF & _ "Seat 5: vovan189 (500 in chips) " & @CRLF & _ "Seat 6: DiMers80 (500 in chips) " & @CRLF & _ "vitalijus: posts the ante 10" & @CRLF & _ "papoca555: posts the ante 10" & @CRLF & _ "SITBACKNOW: posts the ante 10" & @CRLF & _ "hackerpex: posts the ante 10" & @CRLF & _ "vovan189: posts the ante 10 " & @CRLF & _ "DiMers80: posts the ante 10" & @CRLF & _ "papoca555: posts small blind 25" & @CRLF & _ "SITBACKNOW: posts big blind 50" & @CRLF & _ "*** HOLE CARDS ***" & @CRLF & _ "Dealt to hackerpex [7h 6h]" & @CRLF & _ "hackerpex: folds " & @CRLF & _ "vovan189: calls 50" & @CRLF & _ "DiMers80: raises 440 to 490 and is all-in" & @CRLF & _ "vitalijus: folds " & @CRLF & _ "papoca555: folds " & @CRLF & _ "SITBACKNOW: calls 440 and is all-in" & @CRLF & _ "vovan189: calls 440 and is all-in" & @CRLF & _ "*** FLOP *** [5c 2c 3s]" & @CRLF & _ "*** TURN *** [5c 2c 3s] [Ah]" & @CRLF & _ "*** RIVER *** [5c 2c 3s Ah] [4s]" & @CRLF & _ "*** SHOW DOWN ***" & @CRLF & _ "SITBACKNOW: shows [Ks Tc] (a straight, Ace to Five)" & @CRLF & _ "vovan189: shows [6d As] (a straight, Deuce to Six)" & @CRLF & _ "DiMers80: shows [Kc Th] (a straight, Ace to Five)" & @CRLF & _ "vovan189 collected 1555 from pot" & @CRLF & _ "vovan189 wins the $0.44 bounty for eliminating SITBACKNOW" & @CRLF & _ "vovan189 wins the $0.44 bounty for eliminating DiMers80" & @CRLF & _ "SITBACKNOW finished the tournament in 35th place" & @CRLF & _ "DiMers80 finished the tournament in 35th place" & @CRLF & _ "*** SUMMARY ***" & @CRLF & _ "Total pot 1555 | Rake 0 " & @CRLF & _ "Board [5c 2c 3s Ah 4s]" & @CRLF & _ "Seat 1: vitalijus (button) folded before Flop (didn't bet)" & @CRLF & _ "Seat 2: papoca555 (small blind) folded before Flop" & @CRLF & _ "Seat 3: SITBACKNOW (big blind) showed [Ks Tc] and lost with a straight, Ace to Five" & @CRLF & _ "Seat 4: hackerpex folded before Flop (didn't bet)" & @CRLF & _ "Seat 5: vovan189 showed [6d As] and won (1555) with a straight, Deuce to Six" & @CRLF & _ "Seat 6: DiMers80 showed [Kc Th] and lost with a straight, Ace to Five" & @CRLF & _ "PokerStars Hand #152844655854: Tournament #1556870024, $0.44+$0.44+$0.12 USD Hold'em No Limit - Level I (25/50) - 2016/05/04 13:15:28 BRT [2016/05/04 12:15:28 ET]" & @CRLF & _ "Table '1556870024 3' 6-max Seat #2 is the button" & @CRLF & _ "Seat 1: vitalijus (490 in chips) " & @CRLF & _ "Seat 2: papoca555 (465 in chips) " & @CRLF & _ "Seat 4: hackerpex (490 in chips) " & @CRLF & _ "Seat 5: vovan189 (1555 in chips) " & @CRLF & _ "vitalijus: posts the ante 10" & @CRLF & _ "papoca555: posts the ante 10" & @CRLF & _ "hackerpex: posts the ante 10" & @CRLF & _ "vovan189: posts the ante 10" & @CRLF & _ "hackerpex: posts small blind 25" & @CRLF & _ "vovan189: posts big blind 50" & @CRLF & _ "*** HOLE CARDS ***" & @CRLF & _ "Dealt to hackerpex [Jd Ad]" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH) Local $aFullArray[0] For $i = 0 To UBound($aArray) -1 _ArrayConcatenate($aFullArray, $aArray[$i]) Next $aArray = $aFullArray ; Present the entire match result _ArrayDisplay($aArray, "Result")

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 AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm