Skip to Content
Perl for Web Site Management
book

Perl for Web Site Management

by John Callender
October 2001
Beginner
528 pages
15h 20m
English
O'Reilly Media, Inc.
Content preview from Perl for Web Site Management

Trailing Modifiers

After the last delimiter in your regular expression you can place a number of optional modifier characters that affect how the expression operates. Table 7-1 lists the more commonly used ones.

Table 7-1. Regular expression modifiers

Modifier

Description

/g

Make the match global; that is, keep looking for additional matches after the first one has been found.

/i

Match case-insensitively, such that the search pattern /walnuts/i would successfully match Walnuts and WALNUTS and so on.

/m

Treat the string as multiple lines. More specifically, let the ^ beginning-of-string anchor and the $ end-of-string anchor match at the beginning or end (respectively) of internal lines within the search string. Without the /m modifier, these anchors would match only at the beginning or end of the entire string.

/o

Compile the regular expression search pattern only once. If the search pattern contains any variables whose contents change after the first time the expression is compiled, those changes won’t be reflected in the regular expression. In effect, the /o modifier is a promise by you to Perl that any variables in the search pattern are not going to change during the time the script is running.

/s

Treat the string as a single line, even if it isn’t. Specifically, let the special character . (dot), which normally matches any character except a newline, match newline characters embedded in the string.

/x

Allow the use of regular expression ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

Ken Williams, Dave Rolsky
PHP 7: Real World Application Development

PHP 7: Real World Application Development

Doug Bierer, Altaf Hussain, Branko Ajzele
Mastering PHP 7

Mastering PHP 7

Branko Ajzele

Publisher Resources

ISBN: 1565926471Catalog PageErrata