Regular Expressions 101

Save & Share

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

/
/
gm

Test String

Code Generator

Generated Code

$re = '/1\.Account.*\: (\d+).*\:([\w\s]+).*\d.*\:([\w\s\n\.]+).*\n.*California/m'; $str = ' CRBARBARA: Stephen L. Vagnin) 1/25/26 Monterey county Recorder 13:43:32 Recorded at the request of Filer pocumENT: 200600759 ui When Recorded Mail To: LSI 5029 Dudley Blvd., Ste. E McClellan, CA 95652 1 pw Escrow 1977008 Titles: Pages: 56 Fees... 23. 08 Taxes... Other... AMT PAID $23.00 This Instrument Was Prepared By: NISHANT BANGERA Citibank P.O. Box 790017, MS 221 St. Louis, MO 63179 (800) 925-2484 RECORDING REQUESTED BY: FIDELITY NATIONAL TITLE DEED OF TRUST Account No.: 105122812556000 (Space Above This Line For Recorder\'s Use) THIS DEED OF TRUST is made this 01/18/2006, among the Trustor, JASON _R. GRIFFIN AND BORYANA K. GRIFFIN, HUSBAND AND WIFE, AS JOINT TENANTS, of 25431 LARKSPUR CT, SALINAS, CA 93908-1537, (herein "Trustor") Verdugo Trustee Service Corporation (herein "Trustee"), and the Beneficiary, Citibank (West), FSB ("beneficiary"), a corporation organized and existing under the laws of the United States of America whose address is One Sansome St.San Francisco CA_94104 (herein "Lender"). "Borrower" means the individual(s) who has(ve) signed the Fixed Rate Home Equity Loan Note (the "Note") of even date herewith and in connection with this Deed of Trust. Borrower, in consideration of the indebtedness herein recited and the trust herein created, irrevocably grants and conveys to Trustee, in trust, with power of sale, the following described property located in the County of MONTEREY, State of California: SEE ATTACHED RIDER FOR LEGAL DESCRIPTION which has the address of 25431 LARKSPUR CT, SALINAS, CA_93908-1537 (herein "Property Address"). TOGETHER with all the improvements now or hereafter erected on the property, and all easements, rights, appurtenances and rents (subject however to the rights and authorities given herein to Lender to collect and apply such rents), all of which shall be deemed to be and remain a part of the property covered by this Deed of Trust; and all of the foregoing, together with said property (or the leasehold estate if this Deed of Trust is on a leasehold) are hereinafter referred to as the "Property"; TO SECURE to Lender the repayment of the indebtedness evidenced by Borrower\'s note dated 01/18/2006 and extensions and renewals thereof (herein Note), in the principal sum of U.S.$155,000.00, with interest thereon, providing for monthly installments of principal and interest, with the balance of the indebtedness, if not sooner paid, due and payable on 01/23/2036; the payment of all other sums, with interest thereon, advanced in accordance herewith to protect that security of this Deed of Trust; and the performance of the covenants and agreements of Borrower herein contained. Trustor covenants that Trustor is lawfully seized of the estate hereby conveyed and has the right to grant and convey the Property, and that the Property is unencumbered except for encumbrances of record. Trustor covenants that Trustor warrants and will defend generally the title to the Property against all claims and demands, subject to encumbrances of record. UNIFORM COVENANTS. Trustor and Lender covenant and agree as follows: 1, Payment of Principal and Interest. Trustor shall promptly pay when due the principal and interest indebtedness evidenced by the Note and late charges as provided in the Note. 2. Application of Payments. Unless applicable law provides otherwise, all payments received by Lender shall be applied by Lender first to interest payable on the Note and then to the principal of the Note. CALIFORNIA - Second Mortgage - FNMA/FHLMC UNIFORM INSTRUMENT CBN-F-SI-703-CA lof 5 Revised 11/17/2005 GRIFFIN ACAPS: 105122812556000 1.Account No.: 105122812556000 2.Trustee : Verdugo Trustee Service Corporation 3.Trustor: JASON _R. GRIFFIN AND BORYANA K. GRIFFIN, 4.Trustor_relation: JASON _R. GRIFFIN AND BORYANA K. GRIFFIN, HUSBAND AND WIFE, AS JOINT TENANTS 5.property_address: 25431 LARKSPUR CT, SALINAS, CA 93908-1537 6. amount : U.S.$155,000.00, 7. County: MONTEREY 8.State: California '; 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