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.
Matching metacharacters - Perl Tutorial
From the course: Perl 5 Essential Training
Matching metacharacters
- [Voiceover] Perl uses a number of metacharacters with its regular expressions. You need to take special care in order to match those characters in a regular expression, and if I go ahead in here, and I put some parentheses in my string, now when I go ahead and run it, you can see that we have the match there, but what if I wanted to match the parentheses and everything within them? So, in order to match the actual parentheses, I need to escape the parentheses, like this, and so what I've done is, the parentheses that I wanna match, I've added a backslash character before. That's the opening one and that's the closing one, and then my regular parentheses, that are actually being interpreted and used, do not have the backslash, so if I want the regular expression engine to use the parenthesis for the meaning of the parenthesis within the regular expression, then I don't have to use a backslash If I want the regular expression engine to actually match the literal character of the…
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
-
-
-
-
-
-
-
-
-
-
-
About regular expressions4m 8s
-
Matching text2m 9s
-
Common modifiers4m 58s
-
Extracting matches2m 5s
-
Getting a list of matches1m 46s
-
Simple matches2m 46s
-
Matching wildcards4m 38s
-
Matching classes of characters4m 23s
-
Matching metacharacters1m 37s
-
Search and replace4m 32s
-
Splitting strings2m 18s
-
-
-
-
-
-
-
-