|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.acsinet_solutions.util.regexp.Perl5Regexp
public final class Perl5Regexp
Implementation of a simple regular expression class. It is a wrapper over an external perl 5 regular expression facility created to provide a more friendly and change independent interface to the user.
This implementation is based on J2SE regexp facilities. Previous versions of the framework used Jakarta ORO.
This class IS thread safe.
(c) 2004 ACSINET S.A. de C.V. Derechos Reservados
| Constructor Summary | |
|---|---|
Perl5Regexp(java.lang.String re)
Public constructor for a regular expression with no default sunstitution template string and case sensitive |
|
Perl5Regexp(java.lang.String re,
boolean caseSensitive)
Public constructor for a regular expression with no default sunstitution template string |
|
Perl5Regexp(java.lang.String re,
boolean caseSensitive,
java.lang.String defaultSubstitutionTemplate)
Public constructor for a regular expression |
|
| Method Summary | |
|---|---|
java.util.List<java.lang.String> |
apply(java.lang.String str)
Match the string against the given string and return an array of values containing the match. |
java.lang.String |
getExpressionString()
Get the inner regular expression string |
static Perl5Regexp |
getValidRegexp(java.lang.String regexpString)
Get a valid Perl5Regexp object from the given regular expression String instance. |
java.util.List<java.lang.String> |
split(java.lang.String str)
Split a string using the regular expression as delimiter. |
java.util.List<java.lang.String> |
split(java.lang.String str,
boolean returnTokens)
Split a string using the regular expression as delimiter. |
java.lang.String |
substitute(java.lang.String str)
Substitute the results from the regular expression applied into the string given as a parameter into a default tempalate string. |
java.lang.String |
substitute(java.lang.String str,
java.lang.String template)
Substitute the results from the regular expression applied into the string given as a parameter into the given template string. |
java.lang.String |
substitute(java.lang.String str,
java.lang.String template,
java.util.EnumSet<Substitution> flags)
Substitute the results from the regular expression applied into the string given as a parameter into the given template string |
boolean |
test(java.lang.String str)
Test if the given string matches the given string. |
java.util.List<java.lang.String> |
testAndApply(java.lang.String str)
Convenience implementation that combines test() and apply() method and is more efficient when both methods are being used together |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Perl5Regexp(java.lang.String re,
boolean caseSensitive,
java.lang.String defaultSubstitutionTemplate)
throws SyntaxException
re - Regular expression definition stringcaseSensitive - true if the match will be case sensitiva; false
otherwisedefaultSubstitutionTemplate - Default string used for substitution
or null if no default substitution string will be used
com.acsinet_solutions.cetia4.regexp.RegexpSyntaxException - Thrown if a syntax exception is found while creating the
regular exception
SyntaxException
public Perl5Regexp(java.lang.String re,
boolean caseSensitive)
throws SyntaxException
re - Regular expression definition stringcaseSensitive - true if the match will be case sensitiva; false
otherwise
com.acsinet_solutions.cetia4.regexp.RegexpSyntaxException - Thrown if a syntax exception is found while creating the
regular exception
SyntaxException
public Perl5Regexp(java.lang.String re)
throws SyntaxException
re - Regular expression definition string
com.acsinet_solutions.cetia4.regexp.RegexpSyntaxException - Thrown if a syntax exception is found while creating the
regular exception
SyntaxException| Method Detail |
|---|
public static Perl5Regexp getValidRegexp(java.lang.String regexpString)
regexpString - A not-null valid regexp String instance
java.lang.RuntimeException - Thrown if the input regular expression String is not validpublic final boolean test(java.lang.String str)
str - not-null String against whom the regular expression will be
tested.
public final java.util.List<java.lang.String> apply(java.lang.String str)
throws RegexpMatchException
str - String against whom the regular expression will be matched.
com.acsinet_solutions.cetia4.regexp.RegexpMatchException - Thrown if the given string not make match with the regular expression.
For an alternative upon this
use method test() can be used first to check the string matches correctly
or use testAndApply()
RegexpMatchExceptionpublic final java.util.List<java.lang.String> testAndApply(java.lang.String str)
str - String against whom the regular expression will be matched.
public final java.lang.String substitute(java.lang.String str,
java.lang.String template,
java.util.EnumSet<Substitution> flags)
throws RegexpMatchException
str - String against whom the regular expression will be applied.template - String that contains the format info. If template is null,
the internal default template will be used (if any).flags - The following flags can be used:
com.acsinet_solutions.cetia4.regexp.RegexpMatchException - thrown if the
string does not makes match with the regular expression. For an
alternative upon this use method test can be used first to check the
string matches correctly
RegexpMatchException
public final java.lang.String substitute(java.lang.String str,
java.lang.String template)
throws RegexpMatchException
str - String against whom the regular expression will be applied.format - String that contains the format info
com.acsinet_solutions.cetia4.regexp.RegexpMatchException - thrown if the string does not makes match with the regular
expression. For an
alternative upon this use method test can be used first to check the
string matches correctly
RegexpMatchException
public final java.lang.String substitute(java.lang.String str)
throws RegexpMatchException
str - String against whom the regular expression will be applied.
com.acsinet_solutions.cetia4.regexp.RegexpMatchException - thrown if the
string does not makes match with the regular expression. For an
alternative upon this use method test can be used first to check the
string matches correctly
RegexpMatchException
public final java.util.List<java.lang.String> split(java.lang.String str,
boolean returnTokens)
str - String against whom the regular expression will be applied to
obtain make the split.returnTokens - true if we want to return also the tokens, and
false otherwise. The default is false.
public final java.util.List<java.lang.String> split(java.lang.String str)
str - String against whom the regular expression will be applied to
obtain make the split.
public final java.lang.String getExpressionString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||