org.jutil.java.regex
Class Pattern

org.jutil.java.regex.Pattern

public class Pattern

A class that adapts the jregex.Pattern interface to the java.util.regex.Pattern interface.

Version:
$Revision: 1.3 $
Author:
Marko van Dooren

Field Summary
static int DEFAULT
          public invariant pattern() != null;
static int DOTALL
           
static int MULTILINE
           
 
Constructor Summary
Pattern(java.lang.String regex)
          public behavior

pre regex != null;

post pattern().equals(regex);
post flags() == DEFAULT;

signals (PatternSyntaxException) (* The given String is not a valid regular expression *);
Initialize a new Pattern with default flags and the given regular expression
Pattern(java.lang.String regex, int flags)
          public behavior

pre regex != null;
pre (* The given flags must be valid.
 
Method Summary
 int flags()
          Return the flags of this Pattern.
 java.lang.String pattern()
          public behavior

post \result.equals(toString());
Return the pattern used to build this Pattern.
 

Field Detail

DEFAULT

public static final int DEFAULT
public invariant pattern() != null;

DOTALL

public static final int DOTALL

MULTILINE

public static final int MULTILINE
Constructor Detail

Pattern

public Pattern(java.lang.String regex)
        throws jregex.PatternSyntaxException
public behavior

pre regex != null;

post pattern().equals(regex);
post flags() == DEFAULT;

signals (PatternSyntaxException) (* The given String is not a valid regular expression *);
Initialize a new Pattern with default flags and the given regular expression
Parameters:
regex - The regular expression string.

Pattern

public Pattern(java.lang.String regex,
               int flags)
        throws jregex.PatternSyntaxException
public behavior

pre regex != null;
pre (* The given flags must be valid. *);

post pattern().equals(regex);
post flags() == flags;

signals (PatternSyntaxException) (* The given String is not a valid regular expression *);
Initialize a new Pattern with the given regular expression and flags.
Parameters:
regex - The regular expression string.
flags - The flags for the new Pattern.
Method Detail

pattern

public java.lang.String pattern()
public behavior

post \result.equals(toString());
Return the pattern used to build this Pattern.

flags

public int flags()
Return the flags of this Pattern.