public class RegexTools extends Object
| Modifier and Type | Field and Description |
|---|---|
static Set<Character> |
CHARACTERS_TO_ESCAPE
Characters that need to be escaped in a regular expression.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
characterSelector(char main,
char... alternatives)
Builds a regular expression that is a selector for a given character(s).
|
static String |
characterSelector(char mainCharacter,
Collection<Character> alternatives)
Builds a regular expression that is a selector for a given character(s).
|
static StringBuilder |
characterSelector(StringBuilder builder,
char mainCharacter,
Collection<Character> alternatives)
Appends to a given builder a regular expression that is a selector for a given character(s).
|
static String |
escaped(char character)
Escapes the character if it needs to in a regular expression.
|
public static String escaped(char character)
character - Character to escape.CHARACTERS_TO_ESCAPE), otherwise the passed character.public static StringBuilder characterSelector(StringBuilder builder, char mainCharacter, Collection<Character> alternatives)
builder - Builder to add the regular expression to.mainCharacter - The character to select.alternatives - Eventual alternatives.public static String characterSelector(char mainCharacter, Collection<Character> alternatives)
mainCharacter - The character to select.alternatives - Eventual alternatives.public static String characterSelector(char main, char... alternatives)
main - The character to select.alternatives - Eventual alternatives.Copyright © 2023 Miki. All rights reserved.