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

/
/
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 = "([a-zA-Z,.:;\s]+)" Local $sString = " Cross, Kumaraswamy Layout Bangalore-560078, India " & @CRLF & _ "Date of Birth: 17 January, 1990 Phone: 9916970905 Email: neelmani.nm@gmail.com " & @CRLF & _ " " & @CRLF & _ "Seeking Data Scientist position " & @CRLF & _ "SYNOPSIS: * " & @CRLF & _ " Proficient in programming, statistical analysis, data visualization in R " & @CRLF & _ " On-time delivery with utmost quality " & @CRLF & _ " Data driven solution for business problems " & @CRLF & _ " Remarkable ability to identify, extract, analyze and disseminate statistical analysis " & @CRLF & _ " Highly motivated to learn and grow in Data Science " & @CRLF & _ " " & @CRLF & _ "PROFESSIONAL EXPERIENCE " & @CRLF & _ " " & @CRLF & _ "ORGANIZATION: Flutura Data " & @CRLF & _ "Science and Analytics " & @CRLF & _ " " & @CRLF & _ "Category: Service provider " & @CRLF & _ "Domain: Energy, Online Search " & @CRLF & _ "Designation: Data Scientist (Apr 2015 – July 2015) " & @CRLF & _ " " & @CRLF & _ "Role and Responsibilities " & @CRLF & _ " Understanding project requirements " & @CRLF & _ " Getting and Cleaning the data from different data sources using R and Python " & @CRLF & _ " Exploratory data analysis, Data Mining, Data Modelling " & @CRLF & _ " Insight generation and recommendations " & @CRLF & _ " " & @CRLF & _ "ORGANIZATION: Trianz Holding " & @CRLF & _ "Pvt. Ltd. " & @CRLF & _ " " & @CRLF & _ "Category: Service provider " & @CRLF & _ "Domain: e-Governance, Security and " & @CRLF & _ "Protection, Maritime Logistics " & @CRLF & _ "Designation: Software Engineer (July 2012 – Sep 2014) " & @CRLF & _ " " & @CRLF & _ "Role and Responsibilities " & @CRLF & _ " Understanding and gathering project requirements " & @CRLF & _ " Gathering information regarding different data sources " & @CRLF & _ " Identification and conversion of data for analytical modeling " & @CRLF & _ " Report development on the insights of the data " & @CRLF & _ " Migration of data between different data storage location " & @CRLF & _ " Insight generation and recommendations " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ "EDUCATION " & @CRLF & _ " " & @CRLF & _ "Dayananda Sagar College of Engineering, " & @CRLF & _ "Bangalore " & @CRLF & _ "Bachelor of Engineering (B.E), June 2012 " & @CRLF & _ "Major: Telecom., 64.5% " & @CRLF & _ "CBSE – 2006 (XIIth ) – Guru Govind Singh Public School, Bokaro - 73% " & @CRLF & _ "CBSE – 2004 (Xth ) – Jeevan Deep Public School, Nawada - 84% " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " SKILLS " & @CRLF & _ " " & @CRLF & _ "Proficient in R, SQL, MS EXCEL, Pentaho and analytical techniques like linear regression, logistic regression, Hypothesis " & @CRLF & _ "testing, chi square test, ANOVA etc " & @CRLF & _ "Exposer of Python, Qlikview, Tableau " & @CRLF & _ " " & @CRLF & _ " " & @CRLF & _ " CERTIFICATIONS " & @CRLF & _ " " & @CRLF & _ " Foundation of Data Science, University of Texas (MOOC Programme) " & @CRLF & _ " The Data Scientist’s Toolbox, Jhons Hopkins University (Coursera verified certificate) " & @CRLF & _ " R Programming, Jhons Hopkins University (Coursera verified certificate) " & @CRLF & _ " Getting and Cleaning Data, Jhons Hopkins University (Coursera verified certificate) " & @CRLF & _ " Exploratory Data Analysis, Jhons Hopkins University (Coursera verified certificate) " & @CRLF & _ " Reproducibility of Research, Jhons Hopkins University (Coursera verified certificate) " & @CRLF & _ " Statistical Inference, Jhons Hopkins University (Coursera verified certificate) " & @CRLF & _ " Certification in ITIL Foundation " & @CRLF & _ " " & @CRLF & _ "PROJECTS " & @CRLF & _ " " & @CRLF & _ "Online Search:- " & @CRLF & _ "Reports and dashboard for analyzing the user preference for using online search engine. Reports have to be generated for regular " & @CRLF & _ "time interval using R to analyze the trend. " & @CRLF & _ "Energy:- " & @CRLF & _ "Analyzed churn problem by using data from different data sources and logistic regression. A statistical model for predicting the " & @CRLF & _ "future churn. Analyzed the problem and the retail energy domain in US which helped to come up with a statistical model. " & @CRLF & _ "Marine Industry:- " & @CRLF & _ "Gather data from different data sources involving different information regarding the vessel. On top of which analytical insights " & @CRLF & _ "for the vessel performance. " & @CRLF & _ " " & @CRLF & _ "Security and Protection:- " & @CRLF & _ "Fortune 500 company in the securities and protection. Using different data sources centralized reporting system has been " & @CRLF & _ "developed " & @CRLF & _ " " & @CRLF & _ "e-Governance:- " & @CRLF & _ "e-Govenance is a data migration project which is meant to migrate the different department data of the government to a common " & @CRLF & _ "data model. " & @CRLF & _ "" 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