From the course: Perl 5 Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Matching wildcards - Perl Tutorial
From the course: Perl 5 Essential Training
Matching wildcards
- Regular expressions have a simple, yet powerful, system of wildcards. Here's a working copy of wildcards.pl from chapter nine of the Exercise Files. And this is very much like our previous examples, except it's displaying the match with the $1 and the parentheses in the regular expression, so when I run this, it says Match is: text. So, this is just matching a literal string. If I put a period in here instead of the e, that's a wildcard. And so, that will match t and any character, and then x and t. So, I run this, it still says Match is: text. But if I come up here and change this e to a z and I run that, now it says Match text is: tZxt. On the other hand, if I put this back and I move that dot to after the word text, you notice that it comes up and it says false, because you cannot match past the end of the string. I could also match one or more of a particular character. So, if I run this, it'll get the matches t. And, on the other hand, if I put in a bunch of t's here and I run…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
-
(Locked)
About regular expressions4m 8s
-
(Locked)
Matching text2m 9s
-
(Locked)
Common modifiers4m 58s
-
(Locked)
Extracting matches2m 5s
-
(Locked)
Getting a list of matches1m 46s
-
(Locked)
Simple matches2m 46s
-
(Locked)
Matching wildcards4m 38s
-
(Locked)
Matching classes of characters4m 23s
-
(Locked)
Matching metacharacters1m 37s
-
(Locked)
Search and replace4m 32s
-
(Locked)
Splitting strings2m 18s
-
(Locked)
-
-
-
-
-
-
-