org.txt2xml.core
Class RegexMatchProcessor

java.lang.Object
  |
  +--org.txt2xml.core.Processor
        |
        +--org.txt2xml.core.AbstractRegexProcessor
              |
              +--org.txt2xml.core.RegexMatchProcessor

public class RegexMatchProcessor
extends AbstractRegexProcessor

Matches sections of text specified by groups in a regex pattern. For example when regex='\s*(\d),\s*(\d)' this Processor will operate against " 1, 2" with the matches: "1", "2". This Processor does not repeat, so in the above case,] it will operate against "1, 2, 3" with "1", "2" and pass on the remainder ", 3" to a subsequent Processor if any.

Author:
Steve Meyfroidt

Field Summary
 
Fields inherited from class org.txt2xml.core.AbstractRegexProcessor
matcher, pattern, regex
 
Fields inherited from class org.txt2xml.core.Processor
chars, handler, NULL_ATTRIBUTES, parent
 
Constructor Summary
RegexMatchProcessor()
           
 
Method Summary
protected  boolean findMatch()
          Find next match, updating state appropriately.
protected  java.lang.CharSequence getMatchedText()
          Override this!
protected  java.lang.CharSequence getRemainderText()
          Override this!
protected  void resetMatching()
          Matches against the regex to find all matched groups that will be stepped through in findMatch().
 
Methods inherited from class org.txt2xml.core.AbstractRegexProcessor
getRegex, setRegex
 
Methods inherited from class org.txt2xml.core.Processor
generateEndXmlElement, generateStartXmlElement, generateXmlElementCharacters, generateXmlFragment, getElement, getNextProcessor, getSubProcessor, setElement, setNextProcessor, setSubProcessor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexMatchProcessor

public RegexMatchProcessor()
Method Detail

findMatch

protected boolean findMatch()
Description copied from class: Processor
Find next match, updating state appropriately. Override this!

Specified by:
findMatch in class Processor
Returns:
true if got a match, else false.

getMatchedText

protected java.lang.CharSequence getMatchedText()
Description copied from class: Processor
Override this!

Specified by:
getMatchedText in class Processor
Returns:
CharSequence for text matched in last Processor.findMatch().

getRemainderText

protected java.lang.CharSequence getRemainderText()
Description copied from class: Processor
Override this!

Specified by:
getRemainderText in class Processor
Returns:
CharSequence for remainder of text after last match.

resetMatching

protected void resetMatching()
Matches against the regex to find all matched groups that will be stepped through in findMatch().

Overrides:
resetMatching in class AbstractRegexProcessor


Copyright 2002 Steve Meyfroidt. All Rights Reserved.