From the course: LPIC-1 Exam 101 (Version 5.0) Cert Prep

Unlock the full course today

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

Matching characters and words with regexes

Matching characters and words with regexes - Linux Tutorial

From the course: LPIC-1 Exam 101 (Version 5.0) Cert Prep

Start my 1-month free trial

Matching characters and words with regexes

- [Instructor] We're going to start our discussion on extended regular expressions by talking about how to match single characters and words. To match one character of any type except null, we use a dot. To specify which character to match while escaping it, we use a character set with square brackets. If you haven't watched the video on the effective locale on searches, you should do so now. This will explain some very strange behavior with characters set ranges. If we want to match A, B, or C, we'll do left square bracket ABC right square bracket. Note that it will only match one character and that character can be A, B or C. If you want to negate the match, for instance, we want to match one character but it cannot be A, B, or C, we proceed the match with the circumflex. You can do ranges with character sets too, for numbers, this is safe, for letters it's best to use a character class. The POSIX we have matching…

Contents