|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.ed.inf.utils.RegExpUtils
public class RegExpUtils
| Field Summary | |
|---|---|
static boolean |
m_debug
|
| Constructor Summary | |
|---|---|
RegExpUtils()
|
|
| Method Summary | |
|---|---|
static java.util.Vector<java.lang.String> |
getAllMatchedSubstring(java.lang.String regExp,
java.lang.String text,
boolean dotall)
Returns all regular expression matches in the text (as strings) |
static java.util.TreeMap<java.lang.Integer,java.lang.Integer> |
getAllMatchedSubstringsEndpoints(java.lang.String regExp,
java.lang.String text,
boolean dotall)
Gets the start and end index of all regular expression matches in the text |
static java.lang.String |
getFirstMatchedSubstring(java.lang.String regExp,
java.lang.String text)
Gets the first matched substring in the text (dot all mode disabled > the dot does not match the \n character) |
static java.lang.String |
getFirstMatchedSubstring(java.lang.String regExp,
java.lang.String text,
boolean dotall)
Gets the first matched substring in the text |
static java.util.regex.Matcher |
getMatcher(java.lang.String regExp,
java.lang.String text,
boolean dotall)
Get a matcher trained on the given pattern/regular expression and pointing at the text of interest. |
static java.lang.String[] |
splitTextInLines(java.lang.String text)
I am splitting the String based on a regular expression which looks for carriage return (\r) or line feed (\n) or carriage return immediately followed by line feed. |
static boolean |
stringMatchesRegExp(java.lang.String string,
java.lang.String regExp,
boolean dotMatchesNewline)
matches a string against a regular expression (gives true if there is at least a partial match) |
static java.lang.String |
stripXmlHtmlTags(java.lang.String htmlString)
Strips all tags from xml or html code |
static java.lang.String |
substituteMatchedString(java.lang.String string,
java.lang.String regExp,
java.lang.String newString)
Substitute an old string with a new string if the old string matches the given regular expression |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static boolean m_debug
| Constructor Detail |
|---|
public RegExpUtils()
| Method Detail |
|---|
public static java.util.Vector<java.lang.String> getAllMatchedSubstring(java.lang.String regExp,
java.lang.String text,
boolean dotall)
regExp - text - dotall - true if the dot should match the newline character too
public static java.util.TreeMap<java.lang.Integer,java.lang.Integer> getAllMatchedSubstringsEndpoints(java.lang.String regExp,
java.lang.String text,
boolean dotall)
regExp - text - dotall - true if the dot should match the newline character too
public static java.lang.String getFirstMatchedSubstring(java.lang.String regExp,
java.lang.String text)
regExp - text -
public static java.lang.String getFirstMatchedSubstring(java.lang.String regExp,
java.lang.String text,
boolean dotall)
regExp - text - dotall - if true, it enables dotall mode (the dot matches also a
newline)
public static java.util.regex.Matcher getMatcher(java.lang.String regExp,
java.lang.String text,
boolean dotall)
regExp - a regular expressiontext - the text to be searched for regular expression matchesdotall - true if the dot should match the newline character too
public static java.lang.String[] splitTextInLines(java.lang.String text)
text -
public static boolean stringMatchesRegExp(java.lang.String string,
java.lang.String regExp,
boolean dotMatchesNewline)
string - regExp - dotMatchesNewline - enables dotall mode (the dot matches also a newline)
public static java.lang.String stripXmlHtmlTags(java.lang.String htmlString)
htmlString -
public static java.lang.String substituteMatchedString(java.lang.String string,
java.lang.String regExp,
java.lang.String newString)
string - the old stringregExp - a regular expressionnewString - the new string to be substituted
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||