Regular Expressions 101

Save & Share

  • Regex Version: ver. 4
  • 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

$re = '/[\.\!\?\…]?([A-Z]{2,}\s*RESPONSIBILITY\s*[A-Z]{2,}):?/'; $str = '"Titan Elements, Inc. is hiring for an Assistant Marketing Manager Trainee for one of the leading Marketing and Promotional Advertising firms in the Nashville area.PURPOSE: Marketing and Communications for company - Paid Training - Travel Opportunities - ManagementMAJOR RESPONSIBILITY AREASImplementation of marketing plans, including product positioning, campaign strategies, and market strategy insights.Discovery of strategic business opportunities through cross function collaboration with sales, HR, etc.Marketing opportunity for revenueProvide product/service support in order to establish proper channels of information and communication.Responsible for branding, advertising, trade shows, company events and promotional collateralWork with management on projects dealing with media relations, business communications, success storiesJOB REQUIREMENTSCORE COMPETENCIES:These are personal traits that will best help the associate to successfully perform the essential functions of the job.Judgment and Decision Making - Considering the relative costs and benefits of potential actions to choose the most appropriate one.Integrity - Job requires being honest and ethical.Initiative - Job requires a willingness to take on responsibilities and challenges.Leadership - Job requires a willingness to lead, take charge, and offer opinions and direction.Achievement/Effort - Job requires establishing and maintaining personally challenging achievement goals and exerting effort toward mastering tasks.Dependability - Job requires being reliable, responsible, and dependable, and fulfilling obligations.Social Orientation - Job requires preferring to work with others rather than alone, and being personally connected with others on the job.Attention to Detail - Job requires being careful about detail and thorough in completing work tasks.Cooperation - Job requires being pleasant with others on the job and displaying a good-natured, cooperative attitude.Candidate must be very articulate, have a sense of humor, easygoing, but very disciplined. We need a culture fit!ENTRY QUALIFICATIONSBachelor\'s degree in Marketing, Communications, Advertising or JournalismMinimum (0) zero to (5) five years of relevant experience in marketing management with proven success, however we offer paid trainingMust have wide range of experience and understanding of the marketing including product positioning, pricing, promotions, market research, sales and distribution.Should be a proactive self-starter with the ability to work independently. Need strong ability to set priorities, solve problems, and be resourceful under pressure.Experience working with agency/client partners, exhibiting the ability to generate maximum return through effective marketing strategies and direction.BENEFITSPaid trainingGas reimbursementAdvancement opportunitiesUncapped commissionAbout Titan Elements, Inc.:Titan Elements, Inc. is an event marketing firm dedicated to developing dynamic, interactive and results driven campaigns for our clients that are specifically designed to generate brand awareness and establish a greater market share. Each and every event is tailored with the client\'s brand image, target market, and desired exposure level in mind and our team of committed professionals and brand representatives are trained to work with client\'s across a variety of different industries. At Titan Elements, we pride ourselves on our ability to consistently and effectively place our clients\' brands and products in front of consumers when and where it matters most."'; 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