Package ise.antelope.tasks
Class Grep
- java.lang.Object
-
- ise.antelope.tasks.Grep
-
public class Grep extends java.lang.ObjectBorrowed from Antelope, modified to be a general purpose class instead of an Ant task.- Version:
- $Revision: 132 $
-
-
Constructor Summary
Constructors Constructor Description Grep()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetCount()java.lang.StringgetMatch()java.lang.StringgetMatch(int i)java.util.IteratorgetMatches()java.lang.Stringgrep()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.voidsetIn(java.lang.String string)Where to look.voidsetMultiline(boolean b)Sets the multiline attribute for the regex.voidsetRegex(java.lang.String regex)What to look for.voidsetSeparator(java.lang.String s)Used 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)
-
-
-
Method Detail
-
setIn
public void setIn(java.lang.String string)
Where to look.- Parameters:
string- The new in value
-
setRegex
public void setRegex(java.lang.String regex)
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
public java.lang.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
public java.util.Iterator getMatches()
- Returns:
- an Iterator over all matches found by the regular expression.
-
getMatch
public java.lang.String getMatch(int i)
- Returns:
- if there are multiple matches, return the
ith match.
-
setSeparator
public void setSeparator(java.lang.String s)
Used in conjunction withsetAllmatches, this string will be placed between each match in the final result.- Parameters:
s- the separator, default is "".
-
grep
public java.lang.String grep()
Do the grep
-
-