Joshua
open source statistical hierarchical phrase-based machine translation system
|
Public Member Functions | |
Regex (String regex) throws PatternSyntaxException | |
final boolean | matches (String input) |
final String[] | split (CharSequence input) |
final String[] | split (CharSequence input, int limit) |
final String | replaceAll (String input, String replacement) |
final String | replaceFirst (String input, String replacement) |
Static Public Attributes | |
static final Regex | commentOrEmptyLine = new Regex("^\\s*(?:\\#.*)?$") |
static final Regex | floatingNumber = new Regex("^[\\d\\.\\-\\+]+") |
static final Regex | spaces = new Regex("\\s+") |
static final Regex | tabs = new Regex("\\t+") |
static final Regex | equalsWithSpaces = new Regex("\\s*=\\s*") |
static final Regex | threeBarsWithSpace = new Regex("\\s\\|{3}\\s") |
Private Attributes | |
final Pattern | pattern |
This class provides a repository for common regex patterns so that we don't keep recompiling them over and over again. Some convenience methods are provided to make the interface more similar to the convenience functions on String. The convenience methods on String are deprecated except for one-shot patterns (which, by definition, are not in loops).
joshua.util.Regex.Regex | ( | String | regex | ) | throws PatternSyntaxException |
final boolean joshua.util.Regex.matches | ( | String | input | ) |
final String joshua.util.Regex.replaceAll | ( | String | input, |
String | replacement | ||
) |
Replace all substrings of the input which match this Regex
with the specified replacement string.
final String joshua.util.Regex.replaceFirst | ( | String | input, |
String | replacement | ||
) |
Replace the first substring of the input which matches this Regex
with the specified replacement string.
final String [] joshua.util.Regex.split | ( | CharSequence | input | ) |
Split a character sequence, removing instances of this Regex
.
final String [] joshua.util.Regex.split | ( | CharSequence | input, |
int | limit | ||
) |
Split a character sequence, removing instances of this Regex
, up to a limited number of segments.
final Regex joshua.util.Regex.commentOrEmptyLine = new Regex("^\\s*(?:\\#.*)?$") [static] |
A pattern to match if the complete string is empty except for whitespace and end-of-line comments beginning with an octothorpe (#
).
final Regex joshua.util.Regex.equalsWithSpaces = new Regex("\\s*=\\s*") [static] |
A pattern for splitting on the equals character, with optional whitespace on each side.
final Regex joshua.util.Regex.floatingNumber = new Regex("^[\\d\\.\\-\\+]+") [static] |
A pattern to match floating point numbers. (Current implementation is overly permissive.)
final Pattern joshua.util.Regex.pattern [private] |
final Regex joshua.util.Regex.spaces = new Regex("\\s+") [static] |
A pattern for splitting on one or more whitespace.
final Regex joshua.util.Regex.tabs = new Regex("\\t+") [static] |
A pattern for splitting on one or more whitespace.
final Regex joshua.util.Regex.threeBarsWithSpace = new Regex("\\s\\|{3}\\s") [static] |
A pattern for splitting on three vertical pipes, with one or more whitespace on each side.