Package ise.antelope.tasks
Class Grep
java.lang.Object
ise.antelope.tasks.Grep
Borrowed from Antelope, modified to be a general purpose class instead of
an Ant task.
- Version:
- $Revision: 132 $
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetCount()getMatch()getMatch(int i) grep()Do the grepvoidsetAllmatches(boolean b) If true, concatentates all matches into a single result, if false, only the first match is returned in the result.voidsetCanoneq(boolean b) Sets the canoneq attribute for the regex.voidsetCaseinsensitive(boolean b) Sets the caseinsensitive attribute for the regex.voidsetComments(boolean b) Sets the comments attribute for the regex.voidsetDotall(boolean b) Sets the dotall attribute for the regex.voidsetGroup(int g) Set a specific group from the regex.voidWhere to look.voidsetMultiline(boolean b) Sets the multiline attribute for the regex.voidWhat to look for.voidUsed in conjunction withsetAllmatches, this string will be placed between each match in the final result.voidsetUnicodecase(boolean b) Sets the unicodecase attribute for the regex.voidsetUnixlines(boolean b)
-
Constructor Details
-
Grep
public Grep()
-
-
Method Details
-
setIn
Where to look.- Parameters:
string- The new in value
-
setRegex
What to look for.- Parameters:
regex- The new regex value
-
setGroup
public void setGroup(int g) Set a specific group from the regex.- Parameters:
g- The new group value
-
setDotall
public void setDotall(boolean b) Sets the dotall attribute for the regex.- Parameters:
b- The new dotall value
-
setCaseinsensitive
public void setCaseinsensitive(boolean b) Sets the caseinsensitive attribute for the regex.- Parameters:
b- The new caseinsensitive value
-
setMultiline
public void setMultiline(boolean b) Sets the multiline attribute for the regex.- Parameters:
b- The new multiline value
-
setUnicodecase
public void setUnicodecase(boolean b) Sets the unicodecase attribute for the regex.- Parameters:
b- The new unicodecase value
-
setCanoneq
public void setCanoneq(boolean b) Sets the canoneq attribute for the regex.- Parameters:
b- The new canoneq value
-
setComments
public void setComments(boolean b) Sets the comments attribute for the regex.- Parameters:
b- The new comments value
-
setUnixlines
public void setUnixlines(boolean b) -
setAllmatches
public void setAllmatches(boolean b) If true, concatentates all matches into a single result, if false, only the first match is returned in the result.- Parameters:
b- default is false, only show the first match.
-
getCount
public int getCount()- Returns:
- the count of the matches found by the regular expression in the string
-
getMatch
- Returns:
- the match found by the regular expression in the string. If
'all matches' was set to true, then each match will be contained in
this string, separated by the separator specified in
setSeparator
-
getMatches
- Returns:
- an Iterator over all matches found by the regular expression.
-
getMatch
- Returns:
- if there are multiple matches, return the
ith match.
-
setSeparator
Used in conjunction withsetAllmatches, this string will be placed between each match in the final result.- Parameters:
s- the separator, default is "".
-
grep
Do the grep
-