public class VerbalExpression extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
VerbalExpression.Builder |
| Modifier and Type | Method and Description |
|---|---|
String |
getText(String toTest)
Extract full string that matches regex
Same as
getText(String, int) for 0 group |
String |
getText(String toTest,
int group)
Extract exact group from string
|
List<String> |
getTextGroups(String toTest,
int group)
Extract exact group from string and add it to list
Example:
String text = "SampleHelloWorldString";
VerbalExpression regex = regex().capt().oneOf("Hello", "World").endCapt().maybe("String").build();
list = regex.getTextGroups(text, 0) //result: "Hello", "WorldString"
list = regex.getTextGroups(text, 1) //result: "Hello", "World"
|
static VerbalExpression.Builder |
regex()
Creates new instance of VerbalExpression builder
|
static VerbalExpression.Builder |
regex(VerbalExpression.Builder pBuilder)
Creates new instance of VerbalExpression builder from cloned builder
|
boolean |
test(String pToTest)
Test that full string contains regex
|
boolean |
testExact(String pToTest)
Test that full string matches regular expression
|
String |
toString() |
public boolean testExact(String pToTest)
pToTest - - string to check matchpublic boolean test(String pToTest)
pToTest - - string to check matchpublic String getText(String toTest)
getText(String, int) for 0 grouptoTest - - string to extract frompublic String getText(String toTest, int group)
toTest - - string to extract fromgroup - - group to extractpublic List<String> getTextGroups(String toTest, int group)
toTest - - string to extract fromgroup - - group to extractpublic static VerbalExpression.Builder regex(VerbalExpression.Builder pBuilder)
pBuilder - - instance to clonepublic static VerbalExpression.Builder regex()
Copyright © 2017. All rights reserved.