Many beginning programmers learn the basics of regular expressions, but make little effort to master their use—until they’re working in the field, and they start to notice that programmers with solid practical regex skills are often able to marshal those skills to solve a wide variety of text-processing problems more efficiently (in developer hours and lines of code) than programmers without such skills. No matter what a developer’s primary programming language is, mastering regular expressions is an achievable and worthwhile goal.
The links below are a small sample of the learning and reference resources available on regular expressions. These are also linked from the resources page.
Links
-
RegexOne (https://regexone.com)
This can be used as a gentle introduction, in the form of 15 lessons, each introducing and employing a different element of regular expressions. There are also several progressively more challenging exercises you can tackle after the basic lessons.
-
Regular-Expressions.info (https://www.regular-expressions.info)
This site is remarkably content-rich, with comprehensive tutorials, examples, reference pages, and links to useful tools; this is my go-to site when I need to refresh my memory on how some of the more advanced regex elements work.
-
RegexPlanet (http://www.regexplanet.com)
You can use this site to test regular expressions that you’re developing—checking and refining your regexes to get the desired text matching, capturing, and replacement behavior, using test input text you provide. Best of all, you’re not limited to testing with just the Java regular expressions library: several different standard libraries/engines are available for use in your tests.
-
java.util.regex
andjava.util.regex.Pattern
The first link is the Javadocs summary for the
java.util.regex
package in the Java SE 11 standard library. Any regex use in Java, beyond the basic regex-related methods of theString
class, will use classes in this package.The second link is the Javadocs documentation for the
Pattern
class—the usual starting point for building and using regular expressions in Java. The documentation includes a summary of all the regular expression elements supported in the Java standard library.