Regular Expressions
Learn about regular expressions (or "regex") in Java.
StartRegular Expressions: Lesson
Lesson 1 of 1
- 1Have you ever wondered how search engines like Google Search can interpret the text you type and return results accurately to your inquiry? Aside from the higher-level steps of crawling, indexing,…
- 2Java’s java.util.regex package contains three vital classes: - Pattern Class - Matcher Class - PatternSyntaxException Class We’ll start with the Pattern class. This class is Java’s way to defin…
- 3The butter to our bread is the Matcher class. This is Java’s “search” feature, allowing it to take a regular expression defined by the Pattern class and perform a search based on a compiled pattern…
- 4Character classes are one of the primary means of “grouping” characters in a regex pattern without necessarily enforcing an order to those characters. For instance, a character class marks the diff…
- 5We talked about character classes as one of the means to group characters in regex. The other is known as a capture group. Capture groups maintain the order but allow you to section the pattern…
- 6Remember that + character used in the character class example? That’s what regex calls a quantifier. Quantifiers look at preceding tokens and indicate how many matches to look for, defaulting to…
- 7Alternation is just the regex way of saying OR. In regex, this is denoted by the following (note the “ab” and “cd” are user-defined): | Alternation | Description | | — | — | | ab|cd | Match…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory