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

/
/

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 = "Original title: (.*)" Local $sString = "" & @CRLF & _ "Conversation opened. 1 read message." & @CRLF & _ "" & @CRLF & _ "Skip to content" & @CRLF & _ "Using Animateka Mail with screen readers" & @CRLF & _ "prints@animateka.si" & @CRLF & _ "Search" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Click here to enable desktop notifications for Animateka Mail. Learn more Hide" & @CRLF & _ "Mail" & @CRLF & _ "COMPOSE" & @CRLF & _ "Labels" & @CRLF & _ "Inbox" & @CRLF & _ "Starred" & @CRLF & _ "Sent Mail" & @CRLF & _ "Katja" & @CRLF & _ "Smail" & @CRLF & _ "Submissions" & @CRLF & _ "More " & @CRLF & _ " " & @CRLF & _ " More " & @CRLF & _ "21 of 22 " & @CRLF & _ " " & @CRLF & _ "Print all In new window" & @CRLF & _ "Prijavnica" & @CRLF & _ "Inbox" & @CRLF & _ "x " & @CRLF & _ "" & @CRLF & _ "website@animateka.si" & @CRLF & _ "Jul 6 (3 days ago)" & @CRLF & _ "" & @CRLF & _ "to misak " & @CRLF & _ "I apply with my film to the following competition programme:: CENTRAL AND EASTERN EUROPEAN COMPETITION SHORT ANIMATED FILMS" & @CRLF & _ "Original title: Menagerie" & @CRLF & _ "English title: Menagerie" & @CRLF & _ "Running time: 03:28" & @CRLF & _ "Animation Technique: pencil and pen on paper" & @CRLF & _ "Screening format: HD file" & @CRLF & _ "Production year: 2014" & @CRLF & _ "Country: Canada" & @CRLF & _ "Suitable for children: 0" & @CRLF & _ "Age group: 3" & @CRLF & _ "Original language: english / no dialogue" & @CRLF & _ "Subtitles: no dialogue" & @CRLF & _ "Producer: Vancouver Film School" & @CRLF & _ "Distributer: Julian Gallese" & @CRLF & _ "Director: Julian Gallese" & @CRLF & _ "Name: Julian Gallese" & @CRLF & _ "Script: Julian Gallese" & @CRLF & _ "Address: 320 abbott street" & @CRLF & _ "Design: Julian Gallese" & @CRLF & _ "City: Vancouver" & @CRLF & _ "Animation: Julian Gallese" & @CRLF & _ "ZIP: V6B 2K9" & @CRLF & _ "Editing: Rob Wood" & @CRLF & _ "Country: Canada" & @CRLF & _ "Music: Lee Hutzulak" & @CRLF & _ "Phone: 7788295169" & @CRLF & _ "Sound: Julian Gallese" & @CRLF & _ "Email: juliangallese@gmail.com" & @CRLF & _ "SHORT SYNOPSIS: A bird in the water is dreaming about a forest, an ocean liner and himself. Then the tide drifts him to a strange shore." & @CRLF & _ "SHORT BIOGRAPHY AND FILMOGRAPHY OF THE DIRECTOR: Julian is an artist born in 1992. The unknown is his recurrent theme. His work is a constant exploration of the subconscious. His drawings and storytelling brings up the absurd, in an approach that honours irrationality over technique." & @CRLF & _ "filmography: menagerie (2014), untitled (2014)" & @CRLF & _ "Previous festival screenings and awards: - Escala humana, Des Pacio art gallery" & @CRLF & _ "- Spike & Mike's festival of Animation" & @CRLF & _ "- Athens Animfest '15" & @CRLF & _ "- Dum-D Student Animation Festival" & @CRLF & _ "- Future Film Festival, Italy" & @CRLF & _ "- Fest Anča International Animation Festival, Slovakia" & @CRLF & _ "Selection preview copy of the film: 1" & @CRLF & _ "Online film submission: 1" & @CRLF & _ "Link: https://vimeo.com/115080765" & @CRLF & _ "I, the undersigned, acknowledge and agree:: 1, 1" & @CRLF & _ "By checking the option(s) bellow, I agree:: 1, 2, 3" & @CRLF & _ "I have read:: 1" & @CRLF & _ "" & @CRLF & _ "---" & @CRLF & _ "" & @CRLF & _ "http://www.animateka.si/2015/tl_files/upload/stillframe_lq.jpg" & @CRLF & _ "http://www.animateka.si/2015/tl_files/upload/screenshot3.jpg" & @CRLF & _ "http://www.animateka.si/2015/tl_files/upload/julian-6.jpg" & @CRLF & _ " " & @CRLF & _ "Click here to Reply, Reply to all, or Forward" & @CRLF & _ "0.08 GB (0%) of 15 GB used" & @CRLF & _ "Manage" & @CRLF & _ "Program Policies" & @CRLF & _ "Powered by Google" & @CRLF & _ "Last account activity: 27 minutes ago" & @CRLF & _ "Details" & @CRLF & _ "" & @CRLF & _ "" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH) ; 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