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

/
/
gmi

Test String

Code Generator

Generated Code

$re = '/^((?:disposition:|outcome:).*?(?:decisions?|judge?ments?|orders?) ?of(?: ?the)? ?(?:tax court|court of appeals).*?(?:affirmed in part and reversed in part|reversed in part and affirmed in part|affirmed in part and modified in part|affirmed in part|reversed in part|reversed|affirmed|vacated).*)(?:\.|;|,? ?and|,)(.*?(?:decisions?|judge?ments?|orders?|findings?) ?of(?: ?the)?.*?(?:bureau|court(?! of appeals)|board|department|commission).*?(?:affirmed in part and reversed in part|reversed in part and affirmed in part|affirmed in part and modified in part|affirmed in part|reversed in part|reversed|affirmed|vacated))/mi'; $str = 'DISPOSITION: Decision of Court of Appeals and judgment of circuit court affirmed. DISPOSITION: Respondent\'s motion for waiver of the time limit set out in ORAP 9.25(1) is allowed. The petition for reconsideration is allowed. On reconsideration, the former opinion is withdrawn. The decision of the Court of Appeals and the judgment of the circuit court are affirmed. DISPOSITION: The decision of the Court of Appeals and the judgment of the circuit court are affirmed. DISPOSITION: The decision of the Court of Appeals is affirmed. The final order of the Land Use Board of Appeals is affirmed in part and reversed in part, and the case is remanded to the Land Use Board of Appeals for further proceedings. DISPOSITION: The decision of the Court of Appeals is affirmed. The judgment of the circuit court is affirmed in part and reversed in part, and the case is remanded to the circuit court for further proceedings. DISPOSITION: The decision of the Court of Appeals is affirmed. The orders of the circuit court are affirmed in part and reversed in part, and the cases are remanded to the circuit court for further proceedings. DISPOSITION: The decision of the Court of Appeals is affirmed. The order of the circuit court is affirmed, and the case is remanded to the circuit court for further proceedings. DISPOSITION: The decision of the Court of Appeals is affirmed. The appeal is dismissed. DISPOSITION: Decision of the Court of Appeals affirmed in part and reversed in part. Judgment of the circuit court affirmed. DISPOSITION: The decision of the Court of Appeals is affirmed in part and reversed in part. The judgment of the circuit court is affirmed. DISPOSITION: The decision of the Court of Appeals is affirmed in part and reversed in part. The judgment of the circuit court is affirmed in part and reversed in part. DISPOSITION: Court of Appeals affirmed in part and reversed in part and circuit court is affirmed in part and reversed in part; case is remanded. DISPOSITION: The decision of the Court of Appeals is affirmed in part and reversed in part. The revisions to the management plan are upheld in part and invalidated in part, and the case is remanded to the Columbia River Gorge Commission for further proceedings. DISPOSITION: The decision of the Court of Appeals and the judgment of the circuit court are affirmed in part and reversed in part. The case is remanded to the circuit court for further proceedings. DISPOSITION: The judgment of the circuit court is affirmed in part and reversed in part, and the case is remanded to the circuit court. The decision of the Court of Appeals is affirmed. DISPOSITION: Decision of Court of Appeals affirmed. Case remanded to circuit court with instructions to enter judgment on plaintiff\'s fraud claim consistent with jury verdict. DISPOSITION: Court of Appeals\' decision affirmed. Circuit court judgment reversed; remanded to circuit court for further proceedings. DISPOSITION: The decision of the Court of Appeals on class certification and issue class certification is reversed. The trial court order denying class certification and issue class certification is affirmed. The case is remanded for further proceedings on the named plaintiffs\' individual claims. DISPOSITION: The decision of the Court of Appeals is affirmed. The finding of the juvenile court of jurisdiction on the ground that youth engaged in conduct that, if committed by an adult, would constitute first-degree sodomy is reversed. The finding of the juvenile court of jurisdiction on other grounds is affirmed, and the case is remanded to the juvenile court for further proceedings. DISPOSITION: The decision of the Court of Appeals in CA A65075 is affirmed, and the judgment of the circuit court in that case is reversed. The Appeal in CA A8732 is dismissed as moot. DISPOSITION: The decision of the Court of Appeals is affirmed, except that the final order of the Workers\' Compensation Board is vacated. DISPOSITION: The petition for review is dismissed. The decision of the Court of Appeals is vacated, and the judgment of the circuit court is affirmed. DISPOSITION: The decision of the Court of Appeals is modified in part and, as modified, affirmed. The judgment of the circuit court is modified in part and, as modified, affirmed. DISPOSITION: The decision of the Court of Appeals on attorney fees is reversed; the decision of the Court of Appeals is otherwise affirmed. The judgment of the circuit court is affirmed. DISPOSITION: The decision of the Court of Appeals is reversed as to the issues of contract interpretation involving "simulcast" races and attorney fees, but is otherwise affirmed. The judgment of the circuit court is reversed as to the issue of attorney fees, and the case is remanded to that court for further proceedings as to attorney fees. The judgment of the circuit court is otherwise affirmed. '; 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