public class CharacterEscapeTest extends Object
| Constructor | Description |
|---|---|
CharacterEscapeTest() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
testBackspaceRegex() |
The backspace regex:
|
void |
testBellRegex() |
The bell regex:
|
void |
testCarriageReturnRegex() |
The carriageReturn regex:
|
void |
testControlCharacterRegex() |
The controlCharacter regex:
|
void |
testEscapeRegex() |
The escape regex:
|
void |
testFormFeedRegex() |
The formFeed regex:
|
void |
testHexadecimalRegex() |
The hexadecimal regex:
|
void |
testNewLineRegex() |
The newLine regex:
|
void |
testOctalRegex() |
The octal regex:
|
void |
testOtherRegex() |
The otherChar regex:
|
void |
testTabRegex() |
The tab regex:
|
void |
testUnicodeRegex() |
The unicode regex:
|
void |
testVerticalTabRegex() |
The verticalTab regex:
|
public void testBellRegex()
The bell regex:
\a
Matches the bell character.
public void testBackspaceRegex()
The backspace regex:
\b
Matches the backspace character.
public void testTabRegex()
The tab regex:
\t
Matches the tab character.
public void testCarriageReturnRegex()
The carriageReturn regex:
\r
Matches the carriage return character.
public void testVerticalTabRegex()
The verticalTab regex:
\v
Matches the vertical tab character.
public void testFormFeedRegex()
The formFeed regex:
\f
Matches the form feed character.
public void testNewLineRegex()
The newLine regex:
\n
Matches the new line character.
public void testEscapeRegex()
The escape regex:
\e
Matches the escape character.
public void testOctalRegex()
The octal regex:
\nnn
Matches an octal character.
In this example we use the following regex:
\w\40\w
This matches any letter or digit followed by the character defined in the octal representation by 40, which is the space character, which is then followed by another letter or digit.
Using the String "a bc d" we obtain two results:
1: "a b"
2: "c d"
public void testHexadecimalRegex()
The hexadecimal regex:
\x nn
Matches an hexadecimal character.
In this example we use the following regex:
\w\x20\w
This matches any letter or digit followed by the character defined in the hexadecimal representation by 20, which is the space character, which is then followed by another letter or digit.
Using the String "a bc d" we obtain two results:
1: "a b"
2: "c d"
public void testControlCharacterRegex()
The controlCharacter regex:
\cX
Matches a control character.
In this example we use the regex:
\cC
This matches the control character .
public void testUnicodeRegex()
The unicode regex:
\u nnnn
Matches an unicode character.
In this example we use the following regex:
\w\u20\w
This matches any letter or digit followed by the character defined in the unicode representation by 20, which is the space character, which is then followed by another letter or digit.
Using the String "a bc d" we obtain two results:
1: "a b"
2: "c d"
public void testOtherRegex()
The otherChar regex:
\X
This regex is used to represent potential special characters.
In this example we use the following regex:
\d+[\+-quickExpr\*]\d+
This expression should match any sum, subtraction, multiplication of two numbers, for example:
With the String:
(2+2) * 3*9
Results:
1: 2+2
2: 3*9
Copyright © 2018. All rights reserved.