public class WordExpression extends AbstractRegularExpression
ANY_CHAR, ANY_CHAR_EOL, ANY_SIGN, AT_LEAST, AT_MOST, DEBUG, DOUBLE, EOL, EXACTLY, INTEGER, NEGATIVE, NON_NULL, POSITIVE, STRICTLY_NEGATIVE, STRICTLY_POSITIVE, WHITE_SPACES, WHITE_SPACES_OR_EOL
Constructor and Description |
---|
WordExpression()
Parse an expression containing letters only, and stops when a non-letter char is found.
|
WordExpression(java.lang.String postfix,
boolean swallowPostFix)
Constructor with allowsDigit=false (i.e.
|
WordExpression(java.lang.String postfix,
boolean swallowPostFix,
boolean allowDigit)
Allow line-feed's, i.e.
|
WordExpression(java.lang.String postfix,
boolean swallowPostFix,
boolean allowDigit,
boolean noLineFeed) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getValue()
Return the parsed content of this expression after a successfull parsing.
|
boolean |
interpret(Context context)
If parsing was successfull, sends a ParserEvent with value=string found (this may be an empty string)
|
java.lang.String |
toString() |
action
public WordExpression(java.lang.String postfix, boolean swallowPostFix, boolean allowDigit, boolean noLineFeed)
postfix
- a String that signals the end of the word (if NULL, swallows as many letters as possible)swallowPostFix
- if TRUE, move cursor JUST BEHIND the postfix; else move it TO THE POSTFIX POSITIONallowsDigit
- if TRUE, and postfix=NULL, swallows as many "letter-or-digit" as possible (i.e. alphanumeric expression)noLineFeed
- if true, expression must fit on a single line. Otherwise, it may span several lines.public WordExpression(java.lang.String postfix, boolean swallowPostFix, boolean allowDigit)
postfix
- a String that signals the end of the word (if NULL, swallows as many letters as possible)swallowPostFix
- if TRUE, move cursor JUST BEHIND the postfix; else move it TO THE POSTFIX POSITIONallowsDigit
- if TRUE, and postfix=NULL, swallows as many "letter-or-digit" as possible (i.e. alphanumeric expression)public WordExpression(java.lang.String postfix, boolean swallowPostFix)
postfix
- a String that signals the end of the word (if NULL, swallows as many letters as possible)swallowPostFix
- if TRUE, move cursor JUST BEHIND the postfix; else move it TO THE POSTFIX POSITIONpublic WordExpression()
public boolean interpret(Context context) throws REParserException
You may then use Context.removeLineFeeds(String)
to remove CR from "value".
interpret
in class AbstractRegularExpression
REParserException
- if an error occur during parsingpublic java.lang.String getValue()
public java.lang.String toString()
toString
in class java.lang.Object
Submit a bug : syd@jpicedt.org