org.owasp.webscarab.util
Class RegexExpansion

java.lang.Object
  extended by org.owasp.webscarab.util.RegexExpansion
Direct Known Subclasses:
RegexSource

public class RegexExpansion
extends java.lang.Object

This class creates a sequence of Strings that match a reduced Regular Expression syntax. This syntax excludes anything that might allow for variable length strings, or wildcards that would make the character range too large. Some examples of acceptable regular expression constructs: ABCDEF = a sequence of 1 string "ABCDEF" [AB] = a sequence of 2 : { "A", "B" } [A-C] = a sequence of 3 : { "A", "B", "C" } [AB]{2} = a sequence of 4 : { "AA", "AB", "BA", "BB" } [AB]\{ = a sequence of 2: { "A{", "B{" } One specific limitation is that the size of the expansion sequence must fit into an int An expansion that will not fit into an int will throw a PatternSyntaxException during construction In practice, this should not really be a problem.

Author:
rdawes

Constructor Summary
protected RegexExpansion(RegexExpansion re)
          Copy constructor
  RegexExpansion(java.lang.String regex)
          Creates a new instance of RegexExpansion
 
Method Summary
 java.lang.String get(int index)
           
 int getIndex()
           
 java.lang.String getRegex()
          Returns the expression that is being expanded
 boolean hasNext()
           
static void main(java.lang.String[] args)
           
 java.lang.String next()
           
 void setIndex(int index)
          sets the current position in the expansion sequence
 int size()
          returns the number of items in the expansion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexExpansion

public RegexExpansion(java.lang.String regex)
               throws java.util.regex.PatternSyntaxException
Creates a new instance of RegexExpansion

Throws:
java.util.regex.PatternSyntaxException

RegexExpansion

protected RegexExpansion(RegexExpansion re)
Copy constructor

Parameters:
re - the RegexExpansion to copy
Method Detail

getRegex

public java.lang.String getRegex()
Returns the expression that is being expanded

Returns:
the regular expression that is being expanded

size

public int size()
returns the number of items in the expansion

Returns:
the number of items in the expansion

setIndex

public void setIndex(int index)
sets the current position in the expansion sequence

Parameters:
index -

getIndex

public int getIndex()
Returns:

hasNext

public boolean hasNext()
Returns:

next

public java.lang.String next()
Returns:

get

public java.lang.String get(int index)
Parameters:
index -
Returns:

main

public static void main(java.lang.String[] args)