Class RegexReplacementTextFilter
java.lang.Object
com.opensymphony.module.sitemesh.html.rules.RegexReplacementTextFilter
- All Implemented Interfaces:
TextFilter
TextFilter that substitutes content using a JDK 1.4 regular expression.
Example
This will substitute 'Google:Blah' for a link to a google search.
HTMLProcessor processor = new HTMLProcessor(in, out);
processor.addTextFilter(
new RegexReplacementTextFilter("Google:([a-zA-Z]+)", "$1"));
// add more TextFilters and TagRules
processor.process();
- Author:
- Joe Walnes
-
Constructor Summary
ConstructorsConstructorDescriptionRegexReplacementTextFilter(String regex, String replacement) Instantiates a new regex replacement text filter.RegexReplacementTextFilter(Pattern regex, String replacement) Instantiates a new regex replacement text filter. -
Method Summary
-
Constructor Details
-
RegexReplacementTextFilter
Instantiates a new regex replacement text filter.- Parameters:
regex- the regexreplacement- the replacement
-
RegexReplacementTextFilter
Instantiates a new regex replacement text filter.- Parameters:
regex- the regexreplacement- the replacement
-
-
Method Details
-
filter
Description copied from interface:TextFilterFilter.- Specified by:
filterin interfaceTextFilter- Parameters:
text- the content- Returns:
- the string
-