APPENDIX D MORE ON STRINGS AND REGULAR EXPRESSIONS

A regular expression is a formula for matching strings to some pattern. They can provide very powerful mechanisms for describing the pattern, for splitting a string according to the pattern, or for modifying the string around the pattern. At first sight, they can appear daunting because of their complicated construction. However, a little practice can greatly ease matters.

D.1 REGULAR EXPRESSIONS

Regular expressions are essentially a specialized programming language hosted within Groovy. They provide a means of determining whether a string matches some pattern. For example, we might wish to determine whether a string has the pattern of a social security number. We can also use regular expressions ...

Get Groovy Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.