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

/
/
gm

Test String

Code Generator

Generated Code

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { final String regex = "(?s)your\\s*capital\\s*contribution\\s*is\\s*due\\s*on\\s*or\\s*before\\s*(.*?20[1-9][0-9])\\s*\\.?\\s*"; final String string = "\"cash - 0k\n" + "p-ok\n" + "VIOLA wires - 0k\n" + "VENTURES\n" + "unfunded 253,585 - 0k\n" + "March 5, 2020\n" + "To: PAPEF VII-B, L.P.\n" + "Re: Viola Ventures IV - 41st Capital Call\n" + "We are pleased to announce the 41st capital call of Viola Ventures IV (\"\"the Fund\"\"). The Fund expects\n" + "to use this capital contribution to fund follow-on investments in Codefresh Inc. (\"\"Codefresh\"\") and\n" + "Seebo Ltd. (\"\"Seebo\"\").\n" + "The Capital Call proceeds will be applied as follows:\n" + "Use of Contribution Amount ($)\n" + "Investment in Codefresh 1,941,145\n" + "Investment in Seebo 600,000\n" + "Use of reserves (71,494)\n" + "Total 2,469,651\n" + "Pursuant to section 3.2 of the Amended and Restated Limited Partnership Agreements of the Fund,\n" + "notice is hereby given that your capital contribution is due on or before March 19, 2020. The\n" + "contribution to be made by you is $45,161 and is equal to 1.3% of your subscription to the Fund.\n" + "This contribution reflects a recallable amount, previously distributed.\n" + "To date, your share in the recallable distributions made by the Fund equals to $317,093.\n" + "Your aggregate contribution out of such recallable distributions, including this capital call, IS\n" + "$184,533.\n" + "Following this capital call, your remaining recallable amount out of such recallable distributions\n" + "already made by the fund is $132,560.\n" + "Funds, in U.S. dollars, should be wired in accordance with the attached instructions.\n" + "Please have your bank identify the name of the Limited Partner for which the contribution is being\n" + "made. It is important to show the name of the Limited Partner exactly as shown on the subscription\n" + "agreement so that we can identify the sender.\n" + "In the event that you receive a notice or any capital call instructing you to forward the funds to\n" + "another bank account which is not the existing account of the Fund as detailed in the attached\n" + "instructions, please do not transfer the funds and contact us immediately via telephone at +972-9-\n" + "9720400.\n" + "Should you have any questions, please do not hesitate to contact our Partner & CFO, Itzik Avidor,\n" + "iavidor@viola.vc or our Controller, Mor Bar morl@viola-group.com.\n" + "Sincerely yours,\n" + "Viola Ventures 4 L.P.\n" + "By Viola Ventures 4 Ltd., its general partner\n" + "12 Abba Eban Avenue, Bldg. D, Herzeliya, Israel / 09-9720400 / viola.vc\n\n" + "VIOLA\n" + "VENTURES\n" + "Wire Instructions for Capital Contribution\n" + "Bank: Silicon Valley Bank\n" + "Bank Address: 3003 Tasman Drive, Santa Clara, CA 95054\n" + "Account number: 3302648406\n" + "Account name: Viola Ventures IV (A), L.P.\n" + "ABA Routing: 121140399\n" + "Swift code: SVBl<US6S\n" + "Sender: PAPEF VII-B, L.P.\n" + "Amount: 45,161 USD\n" + "Reference: 41st Capital Call\n" + "Unless you are contacted by us via telephone and receive our verbal confirmation to any change in\n" + "the bank account details, you are kindly requested to keep transferring any capital call payments to\n" + "the above mentioned bank account of the Fund. The Fund shall not be responsible for any transfer\n" + "of capital call payments to other bank accounts.\n" + "12 Abba Eban Avenue, Bldg. D, Herzeliya, Israel / 09-9720400 / viola.vc\n\n" + "VIOLA\n" + "VENTURES\n" + "March 5, 2020\n" + "To: PAPEF VII (Offshore)-B, L.P.\n" + "Re: Viola Ventures IV - 41st Capital Call\n" + "We are pleased to announce the 41st capital call of Viola Ventures IV (\"\"the Fund\"\"). The Fund expects\n" + "to use this capital contribution to fund follow-on investments in Codefresh Inc. (\"\"Codefresh\"\") and\n" + "Seebo Ltd. (\"\"Seebo\"\").\n" + "The Capital Call proceeds will be applied as follows:\n" + "Use of Contribution Amount ($)\n" + "Investment in Codefresh 1,941,145\n" + "Investment in Seebo 600,000\n" + "Use of reserves (71,494)\n" + "Total 2,469,651\n" + "Pursuant to section 3.2 of the Amended and Restated Limited Partnership Agreements of the Fund,\n" + "notice is hereby given that your capital contribution is due on or before March 19, 2020. The\n" + "contribution to be made by you is $19,938 and is equal to 1.3% of your subscription to the Fund.\n" + "This contribution reflects a recallable amount, previously distributed.\n" + "To date, your share in the recallable distributions made by the Fund equals to $139,994.\n" + "Your aggregate contribution out of such recallable distributions, including this capital call, IS\n" + "$81,470.\n" + "Following this capital call, your remaining recallable amount out of such recallable distributions\n" + "already made by the fund is $58,524.\n" + "Funds, in U.S. dollars, should be wired in accordance with the attached instructions.\n" + "Please have your bank identify the name of the Limited Partner for which the contribution is being\n" + "made. It is important to show the name of the Limited Partner exactly as shown on the subscription\n" + "agreement so that we can identify the sender.\n" + "In the event that you receive a notice or any capital call instructing you to forward the funds to\n" + "another bank account which is not the existing account of the Fund as detailed in the attached\n" + "instructions, please do not transfer the funds and contact us immediately via telephone at +972-9-\n" + "9720400.\n" + "Should you have any questions, please do not hesitate to contact our Partner & CFO, Itzik Avidor,\n" + "iavidor@viola.vc or our Controller, Mor Bar morl@viola-group.com.\n" + "Sincerely yours,\n" + "Viola Ventures 4 L.P.\n" + "By Viola Ventures 4 Ltd., its general partner\n" + "12 Abba Eban Avenue, Bldg. D, Herzeliya, Israel / 09-9720400 / viola.vc\n\n" + "VIOLA\n" + "VENTURES\n" + "Wire Instructions for Capital Contribution\n" + "Bank: Silicon Valley Bank\n" + "Bank Address: 3003 Tasman Drive, Santa Clara, CA 95054\n" + "Account number: 3302648406\n" + "Account name: Viola Ventures IV (A), L.P.\n" + "ABA Routing: 121140399\n" + "Swift code: SVBl<US6S\n" + "Sender: PAPEF (Offshore)-B, L.P.\n" + "Amount: 19,938 USD\n" + "Reference: 41st Capital Call\n" + "Unless you are contacted by us via telephone and receive our verbal confirmation to any change in\n" + "the bank account details, you are kindly requested to keep transferring any capital call payments to\n" + "the above mentioned bank account of the Fund. The Fund shall not be responsible for any transfer\n" + "of capital call payments to other bank accounts.\n" + "12 Abba Eban Avenue, Bldg. D, Herzeliya, Israel / 09-9720400 / viola.vc\n\n" + "Chelsea McGowan\n" + "From: Mor Bar <Morl@viola-group.com>\n" + "Sent: Thursday, March 12, 2020 11:39 AM\n" + "To: Chelsea McGowan; ViolaVentures Investor Communication\n" + "Cc: papefvii@portad.com\n" + "Subject: RE: Viola Ventures IV - 41st Capital Call\n" + "Hi Chelsea,\n" + "See below:\n" + "PAPEF VII-B, LP - Unfunded commitment - $43,358 and the remaining recallable amount is $132,560.\n" + "PAPEF VII(Offshore)-B, LP - Unfunded commitment - $19,142 and the remaining recallable amount is $58,524.\n" + "Hope it helps,\n" + "Mor\n" + "Mor Bar T +97299720413\n" + "Controller M +972 50 8430844\n" + "Viola morl@viola-group.com\n" + "www.viola-group.com\n" + "From: Chelsea McGowan <cmcgowan@alterdomus.us>\n" + "Sent: Tuesday, March 10, 2020 3:51 PM\n" + "To: ViolaVentures Investor Communication <ViolaVenturesInvestor@viola.vc>\n" + "Cc: papefvii@portad.com\n" + "Subject: RE: Viola Ventures IV - 41st Capital Call\n" + "Good morning,\n" + "Can you please confirm the unfunded commitments for PAPEF VII-B, LP and PAPEF VII(Offshore)-B, LP as of the date of\n" + "the attached notice?\n" + "Thank you,\n" + "CHELSEA MCGOWAN, MSA\n" + "Fund Accountant, US\n" + "9 Old Kings Highway South\n" + "Darien, CT 06820\n" + "Direct: +1 (203) 309-4193\n" + "www.alterDomus.com\n" + "WE'RE WHERE YOU NEED US\n" + "Australia - Belgium - Cayman Islands - China - Cyprus - France - Germany - Guernsey - Hong Kong - Ireland - Jersey - Luxembourg - Malta - Mauritius - Singapore -\n" + "The Netherlands - United Kingdom - USA\n" + "1\n\n" + "Alter Domus Email policy.\n" + "Please consider the environment before printing.\n" + "From: ViolaVentures Investor Communication <ViolaVenturesInvestor@viola.vc>\n" + "Sent: Thursday, March 5, 2020 10:04 AM\n" + "To: Mike T Forward 2019 <mtrinkaus@alterdomus.us>\n" + "Cc: papefvii@portad.com\n" + "Subject: Viola Ventures IV - 41st Capital Call\n" + "Dear Investor,\n" + "PAPEF VII-B, L.P.\n" + "Please find attached the 41st Capital Call of Viola Ventures IV.\n" + "Best regards,\n" + "Viola Ventures\n" + "*NOTICE: This communication is intended only for the use of the individual or entity to which it is addressed and may\n" + "contain confidential and/or legally privileged material. Any forwarding, copying, disclosure, distribution, or other use of\n" + "this information by any person is prohibited. If the reader of this communication is not the intended recipient or his or\n" + "her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this\n" + "communication is strictly prohibited. If you have received this communication in error, please notify sender immediately\n" + "by replying to this message and deleting it from your account.\n" + "2\""; final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); final Matcher matcher = pattern.matcher(string); while (matcher.find()) { System.out.println("Full match: " + matcher.group(0)); for (int i = 1; i <= matcher.groupCount(); i++) { System.out.println("Group " + i + ": " + matcher.group(i)); } } } }

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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html