Regular Expressions 101

Save & Share

  • Regex Version: ver. 5
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

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

/
/
g

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 = "(?i)(.*((\bown(er|re)\b)|(\bocc?up(eir|ier|ire)\b)s?).*)" Local $sString = "customer_name" & @CRLF & _ "Miss. amber Lowe" & @CRLF & _ "Ms. zara scantlebury" & @CRLF & _ "Mrs. Jacky Kalonda" & @CRLF & _ "Mrs. Cynthia Williams" & @CRLF & _ "Mr. Suresh Kotecha" & @CRLF & _ "Rebecca Bormer" & @CRLF & _ "Mr. Affan Hashmi" & @CRLF & _ "Mr. William Dormand" & @CRLF & _ "Mr. Andrew MacIntosh" & @CRLF & _ "Mr. Kieran Ross" & @CRLF & _ "Mrs. rachel pezerovic" & @CRLF & _ "Mr. David Abbott" & @CRLF & _ "Mrs. Fazal Jan Butt" & @CRLF & _ "Owner Occupier" & @CRLF & _ "Mrs. Barbara Feerick" & @CRLF & _ "Mr. Gary Rendell" & @CRLF & _ "Mrs. Natalie Farrell" & @CRLF & _ "Ms. Sally Janani" & @CRLF & _ "Mr. Chris Tween" & @CRLF & _ "Mr. Shahid Ali" & @CRLF & _ "Mr. Govanmurad saifi" & @CRLF & _ "Ms. Vera Lucia" & @CRLF & _ "Nicola Smith" & @CRLF & _ "Mr. Andrew Jessop" & @CRLF & _ "Ashley Phoenix" & @CRLF & _ "Mrs. Rosalie Cross" & @CRLF & _ "Ms. Patricia Smith" & @CRLF & _ "Martin Stewart" & @CRLF & _ "Mr. zakir nazmin" & @CRLF & _ "Owner Occupier" & @CRLF & _ "Mr. Leeanne Jasper" & @CRLF & _ "Owner Occupier" & @CRLF & _ ". Mr Yousuf Munshi C/O Mrs Zulekhan Munshi" & @CRLF & _ "Owner Occupier" & @CRLF & _ "Miss. Gemma Johnson" & @CRLF & _ "Mr. Michael Brown" & @CRLF & _ "Owner Occupiers" & @CRLF & _ "Mr. paul atkins" & @CRLF & _ "Karen Taylor" & @CRLF & _ "Mr. Yusuf Hassan" & @CRLF & _ "Mrs Teresa Geeson" & @CRLF & _ "Mr. Paul Regan" & @CRLF & _ "Mrs Pat Robinson" & @CRLF & _ "Mr. Patrick Jones" & @CRLF & _ "Mrs. chapanben bava" & @CRLF & _ "Mr. Nadeem Tariq" & @CRLF & _ "Mr. Kiran Jayaprakash" & @CRLF & _ "Kris Henley" & @CRLF & _ "Mrs. Denise Gouge" & @CRLF & _ "Mr. Dilip Gurung" & @CRLF & _ "Owner Occupier" & @CRLF & _ "Miss Stephanie Hamman" & @CRLF & _ "Mr. Richard Sneddon" & @CRLF & _ "Mr. AvtarSingh Chauhan" & @CRLF & _ "Mr. Simon Smithen" & @CRLF & _ "Owner Occupier" & @CRLF & _ "Mr. Hussein Hydari" & @CRLF & _ "Mr. kirk wragg" & @CRLF & _ "Mr. Melvyn Orton" & @CRLF & _ "Mr. Derrick Moy" & @CRLF & _ "Miss. Jade Rogers" & @CRLF & _ "Mr. Adam Farnen" & @CRLF & _ "Mr. Mohammad Hossain" & @CRLF & _ "Lauran Kilpatrick" & @CRLF & _ "Mr. Dennis Buffrey" & @CRLF & _ "Mr. Bruce Jones" & @CRLF & _ "Mr. Phillip Christey" & @CRLF & _ "Christine Searle" & @CRLF & _ "Mr. Timothy Shaw" & @CRLF & _ "Mrs. yijia liu" & @CRLF & _ "Mr. Barry Nell" & @CRLF & _ "Mrs. Caroline Rabaiotti" & @CRLF & _ "Owner Occupier" & @CRLF & _ "Mrs. Hazel Bell" & @CRLF & _ "Craig Barrow" & @CRLF & _ "Mr. Mani Dhaliwal" & @CRLF & _ "Mr. Linda Maynard" & @CRLF & _ "Mrs. Amanda Jooma" & @CRLF & _ "Mr. eamon monaghan" & @CRLF & _ "Victoria Fairbourne" & @CRLF & _ "Mrs. Tasleem Akhtar" & @CRLF & _ "Mrs. Cheryl Woollett" & @CRLF & _ "Mr. Alexander Smith" & @CRLF & _ "Mrs. jane beaumont" & @CRLF & _ "Mr. david fergusson" & @CRLF & _ "Mr. Masood Ahmed" & @CRLF & _ "Clare Turner" & @CRLF & _ "Owner Occupier" & @CRLF & _ "Mr. Malcolm Hutchinson" & @CRLF & _ "Jim Stobo" & @CRLF & _ "Mr. richard upton" & @CRLF & _ "Mr. David Canvin" & @CRLF & _ "Miss. Nicola Carlin" & @CRLF & _ "Mr. Jason Kingsley" & @CRLF & _ "Mr Michael Sangster" & @CRLF & _ "Christopher Hill" & @CRLF & _ "Mrs. Balvinder Brar" & @CRLF & _ "Miss. Donna Walsh" & @CRLF & _ "Mark Armstrong" & @CRLF & _ "Miss. Ade Robinson Oshodi" & @CRLF & _ "owner occupier" & @CRLF & _ "Mr. CARE OF Lauristons" & @CRLF & _ "Owner Occupier" & @CRLF & _ "Mr. david Riley" 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