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

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { final String regex = "(?<= --> ).*(?=\\D+|\\$)"; final String string = "1\n" + "00:00:07,200 --> 00:00:10,880\n" + "Hi, I'm Jack Shepard\n" + "and I'm a 3D artist for video games.\n\n" + "2\n" + "00:00:12,640 --> 00:00:16,800\n" + "Throughout my career,\n" + "I've done more than nine AAA projects,\n\n" + "3\n" + "00:00:16,800 --> 00:00:18,360\n" + "including \"Metro Exodus,\"\n\n" + "4\n" + "00:00:18,360 --> 00:00:21,720\n" + "\"Call of Duty: WWII\"\n" + "and \"Overkill's The Walking Dead.\"\n\n" + "5\n" + "00:00:21,720 --> 00:00:25,920\n" + "I work as Supervising Environment\n" + "and Prop Artist at elite3D,\n\n" + "6\n" + "00:00:25,920 --> 00:00:27,960\n" + "a video game outsourcing company.\n\n" + "7\n" + "00:00:29,400 --> 00:00:32,720\n" + "From a young age, video games\n" + "were very present in my life,\n\n" + "8\n" + "00:00:32,720 --> 00:00:35,880\n" + "I really enjoyed drawing\n" + "and writing my own stories.\n\n" + "9\n" + "00:00:35,880 --> 00:00:38,240\n" + "I'm passionate about\n" + "all the hidden stories\n\n" + "10\n" + "00:00:38,240 --> 00:00:40,560\n" + "behind the textures\n" + "of the props and assets,\n\n" + "11\n" + "00:00:40,560 --> 00:00:44,560\n" + "the objects used to decorate\n" + "the game's scenes or world.\n\n" + "12\n" + "00:00:44,560 --> 00:00:47,720\n" + "Everything has a story,\n" + "even if it's an inanimate object.\n\n" + "13\n" + "00:00:48,800 --> 00:00:51,280\n" + "In this course,\n" + "you'll find out\n\n" + "14\n" + "00:00:51,280 --> 00:00:54,280\n" + "what creating props and other video game\n" + "objects consists of.\n\n" + "15\n" + "00:00:54,280 --> 00:00:57,560\n" + "Plus, how to make them\n" + "professional quality.\n\n" + "16\n" + "00:00:58,160 --> 00:01:00,080\n" + "As a project, we'll model a prop\n\n" + "17\n" + "00:01:00,080 --> 00:01:02,280\n" + "that could be in any video game.\n\n" + "18\n" + "00:01:03,000 --> 00:01:05,920\n" + "To do this, I'll share\n" + "sources of inspiration with you\n\n" + "19\n" + "00:01:05,920 --> 00:01:07,920\n" + "that marked the beginning of my career.\n\n" + "20\n" + "00:01:07,920 --> 00:01:10,880\n" + "After, we'll learn the phases\n" + "or the pipeline to follow\n\n" + "21\n" + "00:01:10,880 --> 00:01:12,720\n" + "for developing our asset.\n\n" + "22\n" + "00:01:12,720 --> 00:01:16,320\n" + "We'll find out how to configure\n" + "our software and scripts\n\n" + "23\n" + "00:01:16,320 --> 00:01:18,040\n" + "to save time working.\n\n" + "24\n" + "00:01:18,040 --> 00:01:21,000\n" + "We'll also look at\n" + "the importance of having good references\n\n" + "25\n" + "00:01:21,000 --> 00:01:22,600\n" + "before we start modeling.\n\n" + "26\n" + "00:01:23,040 --> 00:01:25,840\n" + "With this knowledge, we'll get typing\n\n" + "27\n" + "00:01:25,840 --> 00:01:27,800\n" + "to start modeling our asset.\n\n" + "28\n" + "00:01:28,600 --> 00:01:32,160\n" + "First we'll do the block out\n" + "to figure out the prop's dimensions\n\n" + "29\n" + "00:01:32,160 --> 00:01:35,080\n" + "and get an idea of the pieces\n" + "that we'll need\n\n" + "30\n" + "00:01:35,080 --> 00:01:37,040\n" + "to estimate how long this will take us.\n\n" + "31\n" + "00:01:37,040 --> 00:01:40,440\n" + "Then, the high poly phase,\n" + "first with the Sub-D elements,\n\n" + "32\n" + "00:01:40,440 --> 00:01:43,600\n" + "with containment and support loops\n" + "in the more complex pieces.\n\n" + "33\n" + "00:01:43,600 --> 00:01:47,200\n" + "Later, with Zbrush, we'll look at\n" + "how to weld high poly pieces\n\n" + "34\n" + "00:01:47,200 --> 00:01:51,040\n" + "and finally, we'll give our asset\n" + "details with floaters and screws.\n\n" + "35\n" + "00:01:51,680 --> 00:01:55,440\n" + "Then, the low phase\n" + "to reduce the poly of our high poly\n\n" + "36\n" + "00:01:55,440 --> 00:01:59,600\n" + "followed by UV mapping\n" + "and bakes to project detail.\n\n" + "37\n" + "00:01:59,960 --> 00:02:03,040\n" + "We'll work with the substance painter\n" + "to texturize,\n\n" + "38\n" + "00:02:03,040 --> 00:02:06,720\n" + "we'll create our base materials\n" + "to give them history and realism.\n\n" + "39\n" + "00:02:07,480 --> 00:02:09,400\n" + "With our finished asset,\n\n" + "40\n" + "00:02:09,400 --> 00:02:12,920\n" + "we'll see the steps to integrate it\n" + "into our game motor.\n\n" + "41\n" + "00:02:12,920 --> 00:02:15,520\n" + "Lastly, we'll illuminate\n" + "our asset in Marmoset\n\n" + "42\n" + "00:02:15,520 --> 00:02:19,840\n" + "and we'll retouch it in Photoshop\n" + "before posting it on social media.\n\n" + "43\n" + "00:02:19,840 --> 00:02:22,120\n" + "After the course,\n" + "you'll have a complete model\n\n" + "44\n" + "00:02:22,120 --> 00:02:24,840\n" + "with realistic textures\n" + "to use in video games.\n\n" + "45\n" + "00:02:26,320 --> 00:02:29,440\n" + "For this course,\n" + "you should have a basic knowledge\n\n" + "46\n" + "00:02:29,440 --> 00:02:32,040\n" + "of hard surface or poly modeling.\n\n" + "47\n" + "00:02:32,040 --> 00:02:36,040\n" + "Plus, familiarity with\n" + "3ds Max would be very helpful,\n\n" + "48\n" + "00:02:36,040 --> 00:02:39,840\n" + "however, if you know a different one,\n" + "you can follow the course's content.\n\n" + "49\n" + "00:02:40,240 --> 00:02:43,600\n" + "You'll need a computer with 3ds Max\n" + "or similar for modeling\n\n" + "50\n" + "00:02:43,600 --> 00:02:47,120\n" + "and Photoshop CS6 or higher\n" + "for final retouches on the object.\n\n" + "51\n" + "00:02:48,000 --> 00:02:49,320\n" + "Create assets from scratch\n\n" + "52\n" + "00:02:49,320 --> 00:02:52,160\n" + "and do modeling projects\n" + "on a professional level."; 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