java.lang.Object
org.apache.jena.ext.xerces_regex.RegularExpression
- All Implemented Interfaces:
Serializable
A regular expression matching engine using Non-deterministic Finite Automaton (NFA).
This engine does not conform to the POSIX regular expression.
- See Also:
-
Constructor Summary
ConstructorDescriptionRegularExpression
(String regex) Creates a new RegularExpression instance.RegularExpression
(String regex, String options) Creates a new RegularExpression instance with options. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return true if patterns are the same and the options are equivalent.int
Return the number of regular expression groups.Returns a option string.int
hashCode()
boolean
matches
(char[] target) Checks whether the target text contains this pattern or not.boolean
matches
(char[] target, int start, int end) Checks whether the target text contains this pattern in specified range or not.boolean
matches
(char[] target, int start, int end, org.apache.jena.ext.xerces_regex.RegexMatch match) Checks whether the target text contains this pattern in specified range or not.boolean
matches
(char[] target, org.apache.jena.ext.xerces_regex.RegexMatch match) Checks whether the target text contains this pattern or not.boolean
Checks whether the target text contains this pattern or not.boolean
Checks whether the target text contains this pattern in specified range or not.boolean
Checks whether the target text contains this pattern in specified range or not.boolean
Checks whether the target text contains this pattern or not.boolean
matches
(CharacterIterator target) Checks whether the target text contains this pattern or not.boolean
matches
(CharacterIterator target, org.apache.jena.ext.xerces_regex.RegexMatch match) Checks whether the target text contains this pattern or not.void
setPattern
(String newPattern) void
setPattern
(String newPattern, String options) toString()
Represents this instence in String.
-
Constructor Details
-
RegularExpression
Creates a new RegularExpression instance.- Parameters:
regex
- A regular expression- Throws:
RegexParseException
- regex is not conforming to the syntax.
-
RegularExpression
Creates a new RegularExpression instance with options.- Parameters:
regex
- A regular expressionoptions
- A String consisted of "i" "m" "s" "u" "w" "," "X"- Throws:
RegexParseException
- regex is not conforming to the syntax.
-
-
Method Details
-
matches
public boolean matches(char[] target) Checks whether the target text contains this pattern or not.- Returns:
- true if the target is matched to this regular expression.
-
matches
public boolean matches(char[] target, int start, int end) Checks whether the target text contains this pattern in specified range or not.- Parameters:
start
- Start offset of the range.end
- End offset +1 of the range.- Returns:
- true if the target is matched to this regular expression.
-
matches
public boolean matches(char[] target, org.apache.jena.ext.xerces_regex.RegexMatch match) Checks whether the target text contains this pattern or not.- Parameters:
match
- A Match instance for storing matching result.- Returns:
- Offset of the start position in target; or -1 if not match.
-
matches
public boolean matches(char[] target, int start, int end, org.apache.jena.ext.xerces_regex.RegexMatch match) Checks whether the target text contains this pattern in specified range or not.- Parameters:
start
- Start offset of the range.end
- End offset +1 of the range.match
- A Match instance for storing matching result.- Returns:
- Offset of the start position in target; or -1 if not match.
-
matches
Checks whether the target text contains this pattern or not.- Returns:
- true if the target is matched to this regular expression.
-
matches
Checks whether the target text contains this pattern in specified range or not.- Parameters:
start
- Start offset of the range.end
- End offset +1 of the range.- Returns:
- true if the target is matched to this regular expression.
-
matches
Checks whether the target text contains this pattern or not.- Parameters:
match
- A Match instance for storing matching result.- Returns:
- Offset of the start position in target; or -1 if not match.
-
matches
public boolean matches(String target, int start, int end, org.apache.jena.ext.xerces_regex.RegexMatch match) Checks whether the target text contains this pattern in specified range or not.- Parameters:
start
- Start offset of the range.end
- End offset +1 of the range.match
- A Match instance for storing matching result.- Returns:
- Offset of the start position in target; or -1 if not match.
-
matches
Checks whether the target text contains this pattern or not.- Returns:
- true if the target is matched to this regular expression.
-
matches
Checks whether the target text contains this pattern or not.- Parameters:
match
- A Match instance for storing matching result.- Returns:
- Offset of the start position in target; or -1 if not match.
-
setPattern
-
setPattern
-
getPattern
-
toString
Represents this instence in String. -
getOptions
Returns a option string. The order of letters in it may be different from a string specified in a constructor orsetPattern()
. -
equals
Return true if patterns are the same and the options are equivalent. -
hashCode
public int hashCode() -
getNumberOfGroups
public int getNumberOfGroups()Return the number of regular expression groups. This method returns 1 when the regular expression has no capturing-parenthesis.
-