Class RegExSimple
Matches a Java-style regular expression against the string.
The regular-expression should contain groups, each of which provides an element of the
String[] returned for a match.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionRegExSimple(String matchString) Creates with an expression that should match one or more groups.RegExSimple(String expression, Pattern pattern) Creates a newRegExSimpleinstance. -
Method Summary
Modifier and TypeMethodDescriptionA Java-style regular expression containing groups.Returns an array of string components it matches successfully, orOptional.empty()if it cannot match.voidsetExpression(String expression) A Java-style regular expression containing groups.toString()By default, we useAnchorBean.describeBean()as the string representation of the bean.Methods inherited from class org.anchoranalysis.bean.AnchorBean
checkMisconfigured, describeBean, describeChildren, duplicateBean, fields, findFieldsOfClass, getBeanName, getLocalPath, localise
-
Constructor Details
-
RegExSimple
Creates with an expression that should match one or more groups.- Parameters:
matchString- a Java-style regular-expression.
-
RegExSimple
public RegExSimple() -
RegExSimple
Creates a newRegExSimpleinstance.- Parameters:
expression- A Java-style regular expression containing groups.pattern- Lazy creation of a pattern from the regular-expression string.
-
-
Method Details
-
match
Description copied from class:RegExReturns an array of string components it matches successfully, orOptional.empty()if it cannot match.- Specified by:
matchin classRegEx- Parameters:
string- string to match against the regular-expression.- Returns:
- an array of string components representing each group in the match, or
Optional.empty()if no match is possible.
-
toString
Description copied from class:AnchorBeanBy default, we useAnchorBean.describeBean()as the string representation of the bean.- Overrides:
toStringin classAnchorBean<RegEx>- Returns:
- the string representation
-
getExpression
A Java-style regular expression containing groups. -
setExpression
A Java-style regular expression containing groups.
-