ise.antelope.tasks
Class Grep

java.lang.Object
  extended by ise.antelope.tasks.Grep

public class Grep
extends java.lang.Object

Borrowed from Antelope, modified to be a general purpose class instead of an Ant task.

Version:
$Revision: 132 $

Constructor Summary
Grep()
           
 
Method Summary
 int getCount()
           
 java.lang.String getMatch()
           
 java.lang.String getMatch(int i)
           
 java.util.Iterator getMatches()
           
 java.lang.String grep()
          Do the grep
 void setAllmatches(boolean b)
          If true, concatentates all matches into a single result, if false, only the first match is returned in the result.
 void setCanoneq(boolean b)
          Sets the canoneq attribute for the regex.
 void setCaseinsensitive(boolean b)
          Sets the caseinsensitive attribute for the regex.
 void setComments(boolean b)
          Sets the comments attribute for the regex.
 void setDotall(boolean b)
          Sets the dotall attribute for the regex.
 void setGroup(int g)
          Set a specific group from the regex.
 void setIn(java.lang.String string)
          Where to look.
 void setMultiline(boolean b)
          Sets the multiline attribute for the regex.
 void setRegex(java.lang.String regex)
          What to look for.
 void setSeparator(java.lang.String s)
          Used in conjunction with setAllmatches, this string will be placed between each match in the final result.
 void setUnicodecase(boolean b)
          Sets the unicodecase attribute for the regex.
 void setUnixlines(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grep

public Grep()
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 with setAllmatches, 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