From the course: Perl 5 Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Common modifiers

Common modifiers - Perl Tutorial

From the course: Perl 5 Essential Training

Start my 1-month free trial

Common modifiers

- [Voiceover] Modifiers are used to modify the default behavior of the regex parser. Here's a working copy of match.pl from chapter nine of the exercise files, and, you notice if I just run this, I get true, because this match is true. However if I change this to use capital letters and I run it again, you see now it says false, because that no longer matches. I can modify this regular expression to match ignoring case, so it will match upper case, lower case, mixed case, anything, and if I save this and run it, now it's true again, because it's matching without regard to case. So, we return this to its previous state and we're going to now look at the /g modifier, which is the global modifier. In order to understand this, I'm gonna use a regular expression on list context. So I'm gonna say foreach, and that makes it a list context. $s slash i, just the letter i, like that, and that'll list every instance of i in the match. and when I run this, you notice that it only gives us one. It…

Contents