Package org.forgerock.openig.regex
Class PatternTemplate
- java.lang.Object
-
- org.forgerock.openig.regex.PatternTemplate
-
public class PatternTemplate extends Object
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
Constructors Constructor Description PatternTemplate(String value)
Constructs a new template with the specified value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
applyTo(MatchResult result)
Performs a transformation of a match result by applying the template.String
toString()
Returns the literal template value.
-
-
-
Constructor Detail
-
PatternTemplate
public PatternTemplate(String value)
Constructs a new template with the specified value.- Parameters:
value
- the template to apply to regular expression pattern matches.
-
-
Method Detail
-
applyTo
public String applyTo(MatchResult result)
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.
-
-