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

use strict; my $str = '{"slug":"submit\\/252023144241037","jsExecutionTracker":"build-date-1753441690398=>init-started:1753714382726=>validator-called:1753714382731=>validator-mounted-false:1753714382731=>init-complete:1753714382733=>interval-complete:1753714404231=>onsubmit-fired:1753714410305=>observerSubmitHandler_received-submit-event:1753714410306=>submit-validation-passed:1753714410306=>observerSubmitHandler_validation-passed-submitting-form:1753714410309","submitSource":"form","submitDate":"1753714410309","buildDate":"1753441690398","uploadServerUrl":"https:\\/\\/upload.jotform.com\\/upload","eventObserver":"1","q3_saisissezUne":"Company Name: Vandria SA\\r\\nCompany Type: Startup\\r\\nIndustry: Biotech\\r\\nFields: Mitochondrial Therapeutics, Neurodegeneration\\r\\nIndications: Alzheimer\'s Disease, Parkinson\'s Disease, Mild Cognitive Impairment, Major Depressive Disorder, Sporadic Inclusion Body Myositis, Idiopathic Pulmonary Fibrosis, Non-Alcoholic Steatohepatitis\\r\\nKeywords: Mitophagy, Mitochondrial Health, Neuroinflammation, Small Molecules, CNS Disorders, Muscle Diseases, Liver Diseases, Lung Diseases\\r\\nDescription: Vandria blabla, blabla, blabla\\r\\nKey Products or Services: VNA-318: An orally available, patent-protected, brain-penetrant small molecule that induces mitophagy. It has demonstrated cognitive improvement and disease-modifying effects in preclinical models of Alzheimer\'s and Parkinson\'s diseases.\\r\\nCurrent areas of commercialization: EU, US\\r\\nRegulatory Status: VNA-318: Currently undergoing a Phase 1 clinical trial initiated in December 2024.\\r\\nClinical Development: Phase 1 Trial: A randomized, double-blind, combined single and multiple ascending dose study in healthy male subjects to assess safety, tolerability, pharmacokinetics, and pharmacodynamics of VNA-318.\\r\\nPublications: Not found\\r\\nPartnerships or Collaborations: Investors: ND Capital, Hevolution Foundation, Dolby Family Ventures\\r\\nCity: Lausanne \\r\\nCountry: Switzerland\\r\\nFunds Raised: $30.7 million (CHF 28.3 million) in Series A financing\\r\\nDevelopment Stage: Clinical Phase I\\r\\nWebsite: https://www.vandria.com\\/","event_id":"1753714382726_252023144241037_FWvgfju","timeToSubmit":"20","validatedNewRequiredFieldIDs":"{\\"new\\":1}","path":"\\/submit\\/252023144241037"}'; my $regex = qr/Company Name:\s*(?<company_name>[^\\]+)\\r\\nCompany Type:\s*(?<company_type>[^\\]+)\\r\\nIndustry:\s*(?<industry>[^\\]+)\\r\\nFields:\s*(?<fields>[^\\]+)\\r\\nIndications:\s*(?<indications>[^\\]+)\\r\\nKeywords:\s*(?<keywords>[^\\]+)\\r\\nDescription:\s*(?<Description>[^\\]+)\\r\\nKey Products or Services:\s*(?<products>[^\\]+)\\r\\nCurrent areas of commercialization:\s*(?<Current_areas>[^\\]+)\\r\\nRegulatory Status:\s*(?<regulatory_status>[^\\]+)\\r\\nClinical Development:\s*(?<Clinical_Development>[^\\]+)\\r\\nPublications:\s*(?<publications>[^\\]+)\\r\\nPartnerships or Collaborations:\s*(?<partnerships>[^\\]+)\\r\\nCity:\s*(?<city>[^\\]+)\\r\\nCountry:\s*(?<country>[^\\]+)\\r\\nFunds Raised:\s*(?<funds>[^\\]+)\\r\\nDevelopment Stage:\s*(?<development_stage>[^\\]+)\\r\\nWebsite:\s*(?<website>[^"\\]+)/p; if ( $str =~ /$regex/g ) { print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n"; # print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n"; # print "Capture Group 2 is $2 ... and so on\n"; } # ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p' # Named capture groups can be called via $+{name}

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 Perl, please visit: http://perldoc.perl.org/perlre.html