Interpretation of Special Character Strings

Interpretation of Special Character Strings

^ Match The Expression At The Beginning Of The Line.

$ Match The Expression At The End Of Line.

\ Escape The Special Meaning of The Next Character.

- Indicates A Range When Not In The First/Last Position When Specifying Ranges With The "[" and "]" To Specify A List.

| Union Of Regular Expressions

[LIST] Match A Single Character Specified In The List.

[^LIST] Don’t Match A Single Character Specified In The List.

. Match Any Single Character (including non-printable ones)

* Repeat The Previous Regular Expression 0 Or More Times.

+ Repeat The Previous Regular Expression 1 Or More Times.

? Repeat The Previous Regular Expression 0 Or 1 Times.

() Groups Regular Expression.

Previous slide Next slide Back to the first slide View Graphic Version

Notes:

Before we examine more examples, its important to point out that UNIX provides an extensive set of special characters that enables us to define very powerful pattern matches.

These special characters used with regular expressions shouldn’t be confused with the shell metacharacters used for filename expansions or other specific shell interpretations. To be more specific, notice the interpretation of:

Notice how we have special characters that allows us to span an expression! We’ll see some powerful examples shortly.

The key is to simply remember how you’re these special characters.