Package org.forgerock.openig.regex
Class PatternTemplate
java.lang.Object
org.forgerock.openig.regex.PatternTemplate
Expresses a transformation to be applied to a regular expression pattern match. A template
may contain references to groups captured in the match. Each occurrence of
$
g will be substituted by capture group g in a match result. A
dollar sign or numeral literal immediately following a capture group reference may be
included as a literal in the template by preceding it with a backslash (\
).
Backslash itself must be also escaped in this manner.-
Constructor Summary
ConstructorDescriptionPatternTemplate
(String value) Constructs a new template with the specified value. -
Method Summary
Modifier and TypeMethodDescriptionapplyTo
(MatchResult result) Performs a transformation of a match result by applying the template.toString()
Returns the literal template value.
-
Constructor Details
-
PatternTemplate
Constructs a new template with the specified value.- Parameters:
value
- the template to apply to regular expression pattern matches.
-
-
Method Details
-
applyTo
Performs a transformation of a match result by applying the template. References to matching groups that are not in the match result resolve to a blank (""
) value.- Parameters:
result
- the match result to apply the template to.- Returns:
- the value of the matching result with the template applied.
-
toString
Returns the literal template value.
-