|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Dictionary | +--java.util.Hashtable | +--org.apache.ecs.filter.RegexpFilter
This filter uses regexp to create expressions and allows you do a replace on them. It works like the Perl function called subst. Given a regular expression of "a*b", and a String to substituteIn of "aaaabfooaaabgarplyaaabwackyb" and the substitution String "-", the resulting String returned by subst would be "-foo-garply-wacky-".
Filter filter = new RegexpFilter();
filter.addAttribute("a*b","-");
String text = "aaaabfooaaabgarplyaaabwackyb";
String result = filter.process(text);
System.out.println(result);
Produces: -foo-garply-wacky-
Note: "a*" means 0 or more occurences of 'a', therefore the last match
is absolutely correct.
For more information about the regular expression package please do
visit Jakarta Regexp"
Inner classes inherited from class java.util.Map |
java.util.Map.Entry |
Fields inherited from class java.util.Hashtable |
count, emptyEnumerator, emptyIterator, ENTRIES, entrySet, KEYS, keySet, loadFactor, modCount, serialVersionUID, table, threshold, values, VALUES |
Constructor Summary | |
RegexpFilter()
|
Method Summary | |
Filter |
addAttribute(java.lang.String expression,
java.lang.Object substitution)
Add regular expression - substitution pair. |
java.lang.String |
getInfo()
Returns the name of the filter |
boolean |
hasAttribute(java.lang.String expression)
Returns true if this filter contains an expression specified as an argument. |
java.lang.String |
process(java.lang.String to_process)
This method actually performs the filtering. |
Filter |
removeAttribute(java.lang.String expression)
Get rid of the specified expression filter. |
Methods inherited from class java.util.Hashtable |
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait |
Constructor Detail |
public RegexpFilter()
Method Detail |
public java.lang.String getInfo()
getInfo
in interface Filter
public java.lang.String process(java.lang.String to_process)
process
in interface Filter
public Filter addAttribute(java.lang.String expression, java.lang.Object substitution)
addAttribute
in interface Filter
public Filter removeAttribute(java.lang.String expression)
removeAttribute
in interface Filter
public boolean hasAttribute(java.lang.String expression)
hasAttribute
in interface Filter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |