Ask Questions?

View Latest Questions


 
 

Regex Literal Characters
Posted on: July 26, 2006 at 12:00 AM
Most characters can simply be written directly in a regular expression because they're easy to write in a Java string and they have not special meaning to the regular expression engine.

Java: Regex Literal Characters

[SERIOUSLY UNDER CONSTRUCTION] Most characters can simply be written directly in a regular expression because they're easy to write in a Java string and they have not special meaning to the regular expression engine. But some characters are not easily entered or have special meaning.

Characters that can't be typed directly

Java provides several ways to represent characters in a string.
  • Using backslash for specific characters.
  • Unicode representation.
\\ The backslash character
\t The tab character ('\u0009')
\n The newline (line feed) character ('\u000A')
\r The carriage-return character ('\u000D')
\f The form-feed character ('\u000C')
\a The alert (bell) character ('\u0007')
\e The escape character ('\u001B')
\cx The control character corresponding to x
Copyleft 2003 Fred Swartz MIT License, Last update: 2003-10-26

Related Tags for Regex Literal Characters:
javacstringideunicodeormformiotypecharnewlinevinewescapereturnusinglineriaidcharactertabcharactersifforalertctefeedtopresentationcicarriage-returnshebackdesrepresentationcanlipeinrmasmnttrniccanicjesspecdirageicoproackbackslashctlsurntypedrectspeedirectatrackirhallprearactbellcodcodestrspecificreprrtslashvaslascassriringthavstabatiaphatfeprodeono