| Modifier and Type | Method and Description |
|---|---|
VerbalExpression.Builder |
VerbalExpression.Builder.add(String pValue)
Append literal expression
Everything added to the expression should go trough this method
(keep in mind when creating your own methods).
|
VerbalExpression.Builder |
VerbalExpression.Builder.add(VerbalExpression.Builder regex)
Append a regex from builder and wrap it with unnamed group (?: ...
|
VerbalExpression.Builder |
VerbalExpression.Builder.addModifier(char pModifier) |
VerbalExpression.Builder |
VerbalExpression.Builder.any(String value)
Shortcut to
anyOf(String) |
VerbalExpression.Builder |
VerbalExpression.Builder.anyOf(String pValue) |
VerbalExpression.Builder |
VerbalExpression.Builder.anything()
Add expression that matches anything (includes empty string)
|
VerbalExpression.Builder |
VerbalExpression.Builder.anythingBut(String pValue)
Add expression that matches anything, but not passed argument
|
VerbalExpression.Builder |
VerbalExpression.Builder.atLeast(int from)
Produce range count with only minimal number of occurrences
for example:
.find("w").atLeast(1) // produce (?:w){1,}
|
VerbalExpression.Builder |
VerbalExpression.Builder.br()
Shortcut for
lineBreak() |
VerbalExpression.Builder |
VerbalExpression.Builder.capt()
Shortcut for
capture() |
VerbalExpression.Builder |
VerbalExpression.Builder.capture()
Adds capture - open brace to current position and closed to suffixes
|
VerbalExpression.Builder |
VerbalExpression.Builder.count(int count)
Add count of previous group
for example:
.find("w").count(3) // produce - (?:w){3}
|
VerbalExpression.Builder |
VerbalExpression.Builder.count(int from,
int to)
Produce range count
for example:
.find("w").count(1, 3) // produce (?:w){1,3}
|
VerbalExpression.Builder |
VerbalExpression.Builder.digit()
Add same as [0-9]
|
VerbalExpression.Builder |
VerbalExpression.Builder.endCapt()
Shortcut for
endCapture() |
VerbalExpression.Builder |
VerbalExpression.Builder.endCapture()
Close brace for previous capture and remove last closed brace from suffixes
Can be used to continue build regex after capture or to add multiply captures
|
VerbalExpression.Builder |
VerbalExpression.Builder.endGr()
Closes current unnamed and unmatching group
Shortcut for
endCapture()
Use it with group() for prettify code
Example:
regex().group().maybe("word").count(2).endGr() |
VerbalExpression.Builder |
VerbalExpression.Builder.endOfLine()
Mark the expression to end at the last character of the line
Same as
endOfLine(boolean) with true arg |
VerbalExpression.Builder |
VerbalExpression.Builder.endOfLine(boolean pEnable)
Enable or disable the expression to end at the last character of the line
|
VerbalExpression.Builder |
VerbalExpression.Builder.find(String value)
Add a string to the expression
Syntax sugar for
then(String) - use it in case:
regex().find("string") // when it goes first |
VerbalExpression.Builder |
VerbalExpression.Builder.group()
Same as
capture(), but don't save result
May be used to set count of duplicated captures, without creating a new saved capture
Example:
// Without group() - count(2) applies only to second capture
regex().group()
.capt().range("0", "1").endCapt().tab()
.capt().digit().count(5).endCapt()
.endGr().count(2); |
VerbalExpression.Builder |
VerbalExpression.Builder.lineBreak()
Add universal line break expression
|
VerbalExpression.Builder |
VerbalExpression.Builder.maybe(String pValue)
Add a string to the expression that might appear once (or not)
Example:
The following matches all strings that contain http:// or https://
VerbalExpression regex = regex()
.find("http")
.maybe("s")
.then("://")
.anythingBut(" ").build();
regex.test("http://") //true
regex.test("https://") //true
|
VerbalExpression.Builder |
VerbalExpression.Builder.maybe(VerbalExpression.Builder regex)
Add a regex to the expression that might appear once (or not)
Example:
The following matches all names that have a prefix or not.
|
VerbalExpression.Builder |
VerbalExpression.Builder.multiple(String pValue,
int... count)
Convenient method to show that string usage count is exact count, range count or simply one or more
Usage:
regex().multiply("abc") // Produce (?:abc)+
regex().multiply("abc", null) // Produce (?:abc)+
regex().multiply("abc", (int)from) // Produce (?:abc){from}
regex().multiply("abc", (int)from, (int)to) // Produce (?:abc){from, to}
regex().multiply("abc", (int)from, (int)to, (int)...) // Produce (?:abc)+
|
VerbalExpression.Builder |
VerbalExpression.Builder.nonDigit()
Add non-digit: [^0-9]
|
VerbalExpression.Builder |
VerbalExpression.Builder.nonSpace()
Add non-whitespace character: [^\s]
|
VerbalExpression.Builder |
VerbalExpression.Builder.nonWordChar()
Add non-word character: [^\w]
|
VerbalExpression.Builder |
VerbalExpression.Builder.oneOf(String... pValues)
Adds an alternative expression to be matched
based on an array of values
|
VerbalExpression.Builder |
VerbalExpression.Builder.oneOrMore()
Adds "+" char to regexp
Same effect as
atLeast(int) with "1" argument
Also, used by multiple(String, int...) when second argument is null, or have length more than 2 |
VerbalExpression.Builder |
VerbalExpression.Builder.or(String pValue)
Add a alternative expression to be matched
Issue #32
|
VerbalExpression.Builder |
VerbalExpression.Builder.range(String... pArgs)
Add expression to match a range (or multiply ranges)
Usage: .range(from, to [, from, to ...
|
static VerbalExpression.Builder |
VerbalExpression.regex()
Creates new instance of VerbalExpression builder
|
static VerbalExpression.Builder |
VerbalExpression.regex(VerbalExpression.Builder pBuilder)
Creates new instance of VerbalExpression builder from cloned builder
|
VerbalExpression.Builder |
VerbalExpression.Builder.removeModifier(char pModifier) |
VerbalExpression.Builder |
VerbalExpression.Builder.searchOneLine(boolean pEnable) |
VerbalExpression.Builder |
VerbalExpression.Builder.something()
Add expression that matches something that might appear once (or more)
|
VerbalExpression.Builder |
VerbalExpression.Builder.somethingButNot(String pValue) |
VerbalExpression.Builder |
VerbalExpression.Builder.space()
Add whitespace character, same as [ \t\n\x0B\f\r]
|
VerbalExpression.Builder |
VerbalExpression.Builder.startOfLine()
Mark the expression to start at the beginning of the line
Same as
startOfLine(boolean) with true arg |
VerbalExpression.Builder |
VerbalExpression.Builder.startOfLine(boolean pEnable)
Enable or disable the expression to start at the beginning of the line
|
VerbalExpression.Builder |
VerbalExpression.Builder.tab()
Add expression to match a tab character (' ')
|
VerbalExpression.Builder |
VerbalExpression.Builder.then(String pValue)
Add a string to the expression
|
VerbalExpression.Builder |
VerbalExpression.Builder.withAnyCase()
Turn ON matching with ignoring case
Example:
// matches "a"
// matches "A"
regex().find("a").withAnyCase()
|
VerbalExpression.Builder |
VerbalExpression.Builder.withAnyCase(boolean pEnable) |
VerbalExpression.Builder |
VerbalExpression.Builder.word()
Add word, same as [a-zA-Z_0-9]+
|
VerbalExpression.Builder |
VerbalExpression.Builder.wordChar()
Add word character, same as [a-zA-Z_0-9]
|
VerbalExpression.Builder |
VerbalExpression.Builder.zeroOrMore()
Adds "*" char to regexp, means zero or more times repeated
Same effect as
atLeast(int) with "0" argument |
| Modifier and Type | Method and Description |
|---|---|
VerbalExpression.Builder |
VerbalExpression.Builder.add(VerbalExpression.Builder regex)
Append a regex from builder and wrap it with unnamed group (?: ...
|
VerbalExpression.Builder |
VerbalExpression.Builder.maybe(VerbalExpression.Builder regex)
Add a regex to the expression that might appear once (or not)
Example:
The following matches all names that have a prefix or not.
|
static VerbalExpression.Builder |
VerbalExpression.regex(VerbalExpression.Builder pBuilder)
Creates new instance of VerbalExpression builder from cloned builder
|
Copyright © 2017. All rights reserved.