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

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

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php