You can also use the shorthand notation like
A character class defines a set of characters to be matched. The character class
Character classes behave in some special ways. Some special characters (also called metacharacters) lose their special nature inside a character class. Others don’t. And some ordinary characters actually gain special status inside a character class! The table below shows the impact of a character class on wildcards:
Loses special nature. | |
Keeps special nature. | |
Matches any non-digit. | |
Keeps special nature. | |
Keeps special nature. | |
Keeps special nature. | |
Keeps special nature. |
The table below shows the impact on other metacharacters that we didn’t cover yet:
Loses special nature. | |
Loses special nature. | |
Loses special nature. The new interpretation is: matches |
|
Loses special nature. | |
Changes its special nature. Outside character class: matches at the beginning of the string (or beginning of lines in multiline mode). Inside character class: if at the start (like |
|
Loses special nature. | |
Error: |
|
Error: |
|
Gets a new meaning: |
|
Error: |