A Summary of Options and Escapes

Throughout this lesson, I've been mentioning various options you can use with patterns, as well as a number of the special escapes that you can use inside patterns.

Table 10.1 shows the options you can tag onto the end of the pattern matching expression (m// or just //) as well as those that can be used with the substitution expression (s///).

Note

I haven't described all these options in this lesson. You'll learn about some of these in “Going Deeper,” later in this chapter, but you might also want to check out the perlre man page for more information on any options that look interesting.

Table 10.1. Pattern Matching and Substitution Options
Option Use
g Match all occurrences (not just one)
i Match both upper ...

Get Sams Teach Yourself Perl in 21 Days, Second Edition 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.