Regular Expressions Metacharacters are characters that have special meaning within regular expressions. Character Representations metacharacters provides visually pleasing ways to match specific characters that are otherwise difficult to represent. Many utilities provide metacharacters to represent certain control characters that are sometimes machine-dependent, and which would otherwise be difficult to input or to visualize.
Below table well explain us with the usability of each metacharacter for Character Representations.
| Table 1: Regular Expressions Metacharacters for Character Representations | |
| meta-character | Definition ( or Use) |
| \a | Alert (e.g., to sound the bell when "printed") Usually maps to the ASCII <BEL> character, 007 octal. |
| \b | Backspace Usually maps to the ASCII <BS> character, 010 octal. (With many flavors, \b Normally a word boundary, but within a character class it means backspace) |
| \e | Escape character Usually maps to the ASCII <ESC> character, 033 octal. |
| \f | Form feed Usually maps to the ASCII <FF> character, 014 octal. |
| \n | Newline On most platforms (including Unix and DOS/Windows), usually maps to the ASCII <LF> character, 012 octal. On MacOS systems, usually maps to the ASCII <CR> character, 015 octal. With Java or any .NET language, always the ASCII <LF> character regardless of platform. |
| \r | Carriage return Usually maps to the ASCII <CR> character. On MacOS systems, usually maps to the ASCII <LF> character. With Java or any .NET language, always the ASCII <CR> character regardless of platform. |
| \t | Normal horizontal tab Maps to the ASCII <HT> character, 011 octal. |
| \v | Vertical tab Usually maps to the ASCII <VT> character, 013 octal. |
| \num | Character whose ASCII octal code is "num".For example, \015\012 matches an ASCII CR/LF sequence. Octal escapes can be convenient for inserting hard-to-type characters into an expression. |
| \xnum, \x{num} | Similar to octal escapes, many utilities allow a hexadecimal (base 16) value to be entered using \x, for example, \x0D\x0A matches the CR/LF sequence. |
| \unum, \Unum | Similar to octal escapes, many utilities allow a Unicode value to be entered using \u, or sometimes \U. |
| \cchar | Control character, for example carriage return (Ctrl-M) is \cM |





Comments
No comments yet.
Leave a comment