Regular Expressions provide a concise language for validating, parsing, and extracting text. This course will teach you the full regex syntax supported in Java, as well as the special Java regex class support, with many examples.
As technology advances, there are ever more use cases requiring text validation, parsing, and extraction. The old school way was to hack a solution in the target programming language, but this is brittle and leads to arcane code. In this course, Java Fundamentals: The Regular Expressions Playbook, you will learn all of the regular expressions syntax supported in Java. First, you learn about literals for matching and quantifiers for specifying repeat counts. Next, you will discover the special Java class support for text processing. Finally, you will explore advanced techniques for creating and deciphering regular expressions and a brief survey of some popular frameworks that depend on Regex. When you are finished with this course, you will have all of the knowledge you need to validate and process text using regular expressions in Java.
Victor Grazi is an Oracle Java Champion, InfoQ Java Editor, and Java evangelist working at Nomura Securities. He hosts the "Java Concurrent Animated" open source project.
Section Introduction Transcripts
Section Introduction Transcripts
Course Overview Hi everyone, my name is Victor Grazi, and welcome to my course, Java Fundamentals: The Regular Expressions Playbook. I'm a long-time developer, Java Champion, and probably like you, a general geek, having worked in the financial and technology industries all of my life. There is almost not a day that goes by where I am not confronted with some task requiring text processing. Rather than just hard-coding some brittle solution, regular expressions help me to express text processing instructions using just a few simple commands. In this course, we are going to cover all of the regular expression syntax supported in Java, starting from the fundamentals. We will look at the special Java RegEx class support in the JDK for searching, extracting, and replacing text. Then we will cover some important tips for crafting and analyzing our own regular expressions. Some of the major topics that we will cover include quantifiers and quantifier modes, anchors and boundaries, look-arounds, Unicode support, and JDK regex support. By the end of this course, you'll know how to express all of the regex patterns you'll need for text searching, validation, and parsing using Java, and all of the Java regex class support for compiling, configuring, and processing your Java regular expressions. Before beginning this course, you should be at least familiar with the basics of Java. I hope you'll join me on this journey to learn regular expressions in Java with the course, Java Fundamentals: The Regular Expressions Playbook, at Pluralsight.
Text Processing in Java with RegEx Welcome back to our course, Java Fundamentals: The Regular Expressions Playbook. So far, we've taken a glimpse at the power of regex. In this module, we will start to get our hands dirty. In the first clip, we will take a look at the regex tool, a Java application that can help us build and visualize regular expressions. Then in the second clip we will learn some regex fundamentals. In the third clip, we will start exploring the Java regex implementation, including built-in regex support in the String class. And finally, in the fourth clip we will take a closer look at the special Java regex supporting classes, Pattern, Matcher, and PatternSyntaxException. To help us compose and visualize our regular expressions, I've prepared a regex tool, which is a self-executing jar that is available in the assets of this module. Just double-click the jar to launch it. In the top part of the regex tester, you can enter a regex pattern, and in the bottom you can enter a target string. Matches are highlighted in blue. we will learn shortly about capture groups, which are sub-sequences of your pattern that are surrounded with parentheses. When you position the cursor after the beginning or end of a capture group, the corresponding match in the target string will be highlighted in a darker blue. We will see some of the more advanced uses of the regex tool as the course proceeds.