Package com.opensymphony.module.sitemesh.html.rules

# Class RegexReplacementTextFilter

java.lang.Object
com.opensymphony.module.sitemesh.html.rules.RegexReplacementTextFilter

All Implemented Interfaces:
  `TextFilter`

public class RegexReplacementTextFilter extends Object implements 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

## Field Summary

Fields
Modifier and Type
Field
Description
`private final Pattern`
`regex`
`private final String`
`replacement`

## Constructor Summary

Constructors
Constructor
Description
`RegexReplacementTextFilter(String regex, String replacement)`
`RegexReplacementTextFilter(Pattern regex, String replacement)`

## Method Summary

Modifier and Type
Method
Description
`String`
`filter(String text)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### regex

private final Pattern regex

### replacement

private final String replacement

## Constructor Details

### RegexReplacementTextFilter

public RegexReplacementTextFilter(String regex, String replacement)

### RegexReplacementTextFilter

public RegexReplacementTextFilter(Pattern regex, String replacement)

## Method Details

### filter

public String filter(String text)

Specified by:
  `filter` in interface `TextFilter`