O'Reilly logo

Building Parsers with Java™ by Steven John Metsker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

8.1. The Role of Regular Expressions

Regular expressions appear frequently in support of user interfaces. For example, a user might want to see all the files that end with ".txt" or all the books whose titles include "Java" and "Parsers". When you allow a user to specify such a pattern, you are using regular expressions to let the user create a new little language. You might decide, for example, to allow your user to use a tilde to mean zero or more characters. If your user types "~.txt", he or she is defining the language of all strings that end with ".txt".

The tools you provide your user for matching are a metalanguage, a language for defining new languages. Typically, developers provide users with symbols such as “~” and “|” to indicate which ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required