Class RegExSimple
Object
org.anchoranalysis.bean.AnchorBean<RegEx>
org.anchoranalysis.bean.shared.regex.RegEx
org.anchoranalysis.bean.shared.regex.RegExSimple
public class RegExSimple extends RegEx
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
Constructors Constructor Description RegExSimple()RegExSimple(String matchString)Creates with an expression that should match one or more groups.RegExSimple(String expression, Pattern pattern) -
Method Summary
Modifier and Type Method Description StringgetExpression()A Java-style regular expression containing groups.Optional<String[]>match(String string)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.StringtoString()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
-
-
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
- Overrides:
toStringin classAnchorBean<RegEx>
-
getExpression
A Java-style regular expression containing groups. -
setExpression
A Java-style regular expression containing groups.
-