Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
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
Processing...

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 = "(\\d\\d:\\d\\d - \\d\\d:\\d\\d)"; final String string = "Yuri Furusho (WORK), CD Vacation Time\n" + "Mon Oct 28, 2019\n" + "11:00 - 11:30 CD Sprint Kickoff\n" + "Video call: https://meet.google.com/ruf-swic-wps Phone number: tel:+1-937-506-6349 PIN: 512139043 Calendar: Rylan Halteman\n" + "13:00 - 13:45 Weekly All Hands\n" + "Where: Main-3-Wattpad Office Events (80) Calendar: Gina Freitag\n" + "Created by: Rebecca Sands\n" + "14:30 - 15:00 Android Regression Testing Where: Kitchen\n" + "Calendar: Rashad Sookram\n" + "15:00 - 15:30 Quick chat about continue reading\n" + "Video call: https://meet.google.com/kym-kjuh-epj Phone number: tel:+1-226-213-9130 PIN: 567206490 Calendar: Zoe DiNovi\n" + "15:00 - 17:00 Squad CD: Open Meeting Block Calendar: Rylan Halteman\n" + "Tue Oct 29, 2019\n" + "11:30 - 13:30 Wattpad + LifeLabs: Feedback Skills\n" + "Video call: https://meet.google.com/nnd-yrpk-hzy Phone number: tel:+1-650-394-7019 PIN: 115228211 Where: 42-Baka Sakali\n" + "Calendar: Su Zielinski\n" + "13:00 - 17:00 Squad CD: No Recurring Meetings\n" + "Video call: https://meet.google.com/eir-gdqb-pty Phone number: tel:+1-484-424-6792 PIN: 404661941 Calendar: Rylan Halteman\n" + "Wed Oct 30, 2019\n" + "10:50 - 11:00 CD Standup\n" + "Video call: https://meet.google.com/wjc-jgcu-zoy Phone number: tel:+1-662-792-0993 PIN: 569887053 Calendar: Rylan Halteman\n" + "Created by: Adriel Dean-Hall\n" + "11:30 - 12:00 Brandon Yuri 1:1\n" + "Video call: https://meet.google.com/xaq-tryr-kau Phone number: tel:+1-813-948-2356 PIN: 873696570 Where: Main-2-The Cellar (2)\n" + "Calendar: Brandon Zhao\n" + "12:00 - 13:00 Core Lunch 'N Learn (Optional) Where: Wattpad Kitchen , https://zoom.us/j/929891174\n" + "Calendar: Gina Freitag\n" + "13:30 - 14:00 Rylan Yuri sprint planning\n" + "Video call: https://meet.google.com/trx-xpts-ncr Phone number: tel:+1-929-276-1322 PIN: 535064633 Where: Main-3-Kitchen TV Area (10)\n" + "Thu Oct 31, 2019\n" + "12:00 - 13:00 Annual HalloWattys (A Wattpad Halloween Costume Contest)\n" + "Video call: https://meet.google.com/mbp-uvjp-pfu Phone number: tel:+1-502-547-4437 PIN: 768243398 Where: Kitchen , Main-3-Kitchen TV Area (10) Calendar: Emily Nguyen\n" + "16:00 - 16:15 Cheers & Celebrations\n" + "Where: Main-3-Wattpad Office Events (80) Calendar: Su Zielinski\n" + " \n" + "Yuri Furusho (WORK), CD Vacation Time\n" + "Fri Nov 1, 2019\n" + "10:50 - 11:00 CD Standup\n" + "Video call: https://meet.google.com/wjc-jgcu-zoy Phone number: tel:+1-662-792-0993 PIN: 569887053 Calendar: Rylan Halteman\n" + "13:00 - 14:00 FLU SHOT Mon Nov 4, 2019\n" + "10:50 - 11:00 CD Standup\n" + "Video call: https://meet.google.com/wjc-jgcu-zoy Phone number: tel:+1-662-792-0993 PIN: 569887053 Where: Our Pod\n" + "Calendar: Rylan Halteman\n" + "13:00 - 13:45 Weekly All Hands\n" + "Where: Main-3-Wattpad Office Events (80) Calendar: Gina Freitag\n" + "Created by: Rebecca Sands\n" + "14:30 - 15:00 Android Regression Testing Where: Kitchen\n" + "Calendar: Rashad Sookram\n" + "15:00 - 17:00 Squad CD: Open Meeting Block\n" + "Calendar: Rylan Halteman 15:30 - 17:00 Squad Retro\n" + "Video call: https://meet.google.com/nag-btic-tje\n" + "Phone number: tel:+1-929-276-1119 PIN: 353450953\n" + "Where: Main-3-Chasing Red (14) [Conference Phone, Video Conference] Calendar: Rylan Halteman\n" + "Tue Nov 5, 2019\n" + "13:00 - 17:00 Squad CD: No Recurring Meetings\n" + "Video call: https://meet.google.com/eir-gdqb-pty Phone number: tel:+1-484-424-6792 PIN: 404661941 Calendar: Rylan Halteman\n" + "Wed Nov 6, 2019\n" + "09:00 - 10:45 Plan for next Sprint\n" + "10:50 - 11:00 CD Standup\n" + "Video call: https://meet.google.com/wjc-jgcu-zoy Phone number: tel:+1-662-792-0993 PIN: 569887053 Calendar: Rylan Halteman\n" + "Created by: Adriel Dean-Hall\n" + "11:30 - 12:00 Brandon Yuri 1:1\n" + "Video call: https://meet.google.com/xaq-tryr-kau Phone number: tel:+1-813-948-2356 PIN: 873696570 Where: Main-2-The Cellar (2)\n" + "Calendar: Brandon Zhao\n" + "13:30 - 14:00 Yuri + Zoe meet!\n" + "Video call: https://meet.google.com/zxc-jnra-hwu Phone number: tel:+1-470-485-9853 PIN: 729936893 Where: Main-3-White Stag (6)\n" + "Calendar: Zoe DiNovi\n" + "14:30 - 15:00 CD - Client Estimations\n" + "Video call: https://meet.google.com/odn-pmak-qgr\n" + "Phone number: tel:+1-530-428-6641 PIN: 202981230\n" + "Where: Main-2-Light As A Feather (6) [Conference Phone, Webcam] Calendar: Rylan Halteman\n" + "15:00 - 17:00 CD Estimations - 1hr\n" + "Video call: https://meet.google.com/edz-bjgu-aug\n" + "Phone number: tel:+1-262-427-8058 PIN: 632357260\n" + "Where: Main-3-Death Is My BFF (10) [Conference Phone, Video Conference] Calendar: Rylan Halteman\n" + "Created by: Zoe DiNovi\n" + " \n" + "Yuri Furusho (WORK), CD Vacation Time\n" + "Thu Nov 7, 2019\n" + "11:00 - 11:45 CD Sprint Retro\n" + "Video call: https://meet.google.com/aos-kyxd-vjv\n" + "Phone number: tel:+1-470-238-8091 PIN: 103725028\n" + "Where: Main-3-Chasing Red (14) [Conference Phone, Video Conference] Calendar: Rylan Halteman\n" + "Created by: Zoe DiNovi\n" + "13:30 - 14:30 Guild Android Meeting\n" + "Video call: https://meet.google.com/ctr-hmos-chy\n" + "Phone number: tel:+1-318-431-0871 PIN: 740066937\n" + "Where: Main-3-Chasing Red (14) [Conference Phone, Video Conference] Calendar: Rashad Sookram\n" + "16:00 - 18:30 Family Feud 2019 Edition\n" + "Video call: https://meet.google.com/oaz-cqvq-izo\n" + "Phone number: tel:+1-226-314-8544 PIN: 900323491\n" + "Where: HQ Kitchen, (Shared)-Main-Wattpad - Learning & Development Calendar: Emma Brooks\n" + "Fri Nov 8, 2019\n" + "10:30 - 13:00 Guild Android Working Session\n" + "Video call: https://meet.google.com/bvu-zpbr-idg\n" + "Phone number: tel:+1-929-445-0869 PIN: 193571697\n" + "Where: Main-3-Chasing Red (14) [Conference Phone, Video Conference] Calendar: Rashad Sookram\n" + "13:00 - 14:00 Guild Android Self Paid Lunch\n" + "Video call: https://meet.google.com/rwk-auic-xrt Phone number: tel:+1-413-276-7819 PIN: 319785391 Calendar: Ian Ko\n" + " "; 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