public class CharacterClassesTest extends Object
| Constructor | Description |
|---|---|
CharacterClassesTest() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
testAnyCharRegex() |
The anyChar regex:
|
void |
testAnyDigitRegex() |
The anyDigit regex:
|
void |
testAnyLetterOrDigitRegex() |
The anyLetterOrDigit regex:
|
void |
testAnyNonDigitRegex() |
The anyNonDigit regex:
|
void |
testAnyNonLetterOrDigitRegex() |
The anyNonLetterOrDigit regex:
|
void |
testAnyNonWhiteSpaceRegex() |
The anyNonWhiteSpace regex:
|
void |
testAnyWhiteSpaceRegex() |
The anyWhiteSpace regex:
|
void |
testCharacterGroupRegex() |
The characterGroup regex:
|
void |
testCharacterNotGroupRegex() |
The characterGroup regex:
|
void |
testFromFirstUntilLastRegex() |
The characterGroup regex:
|
void |
testUnicodeBlockRegex() |
The unicodeBlock regex:
|
void |
testUnicodeNotBlockRegex() |
The unicodeNotBlock regex:
|
public void testCharacterGroupRegex()
The characterGroup regex:
[characterGroup]
In this example we use the following regex:
[ae]
This will match any 'a' or 'e' characters in the received String.
public void testCharacterNotGroupRegex()
The characterGroup regex:
[^characterGroup]
In this example we use the following regex:
[^ae]
This will match any character other than 'a' or 'e' in the received String.
public void testFromFirstUntilLastRegex()
The characterGroup regex:
[first-last]
In this example we use the following regex:
[a-d|r-z]
This will match any characters between 'a' and 'd' or between 'r' and < in the receiving String.
public void testAnyCharRegex()
The anyChar regex:
.
This will match any character, except line terminators.
public void testUnicodeBlockRegex()
The unicodeBlock regex:
\p{X}
In this example we use the following regex:
\p{Lu}
This matches all the characters that belong to the received unicode block. In this example it will match all
uppercase letters, since the used block is "Lu".
public void testUnicodeNotBlockRegex()
The unicodeNotBlock regex:
\P{X}
In this example we use the following regex:
\P{Lu}
This matches all the characters that don't belong to the received unicode block. In this example it will match all characters that aren't uppercase letters letters, since the used block is "Lu".
public void testAnyLetterOrDigitRegex()
The anyLetterOrDigit regex:
\w
Matches any letter or digit.
public void testAnyNonLetterOrDigitRegex()
The anyNonLetterOrDigit regex:
\W
Matches anything other than a letter or a digit.
public void testAnyWhiteSpaceRegex()
The anyWhiteSpace regex:
\s
Matches any white space character.
public void testAnyNonWhiteSpaceRegex()
The anyNonWhiteSpace regex:
\S
Matches any non white space character.
public void testAnyDigitRegex()
The anyDigit regex:
\d
Matches any digit.
public void testAnyNonDigitRegex()
The anyNonDigit regex:
\d
Matches any non digit.
Copyright © 2018. All rights reserved.