import com.stevesoft.pat.wrap.StringWrap;
+
/** Matches a Unicode punctuation character. */
class UnicodePunct extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && Prop.isPunct(s.charAt(from)) ? to : -1;
/** Matches a Unicode white space character. */
class UnicodeWhite extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && Prop.isWhite(s.charAt(from)) ? to : -1;
*/
class NUnicodePunct extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && !Prop.isPunct(s.charAt(from)) ? to : -1;
*/
class NUnicodeWhite extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && !Prop.isWhite(s.charAt(from)) ? to : -1;
/** Matches a Unicode word character: an alphanumeric or underscore. */
class UnicodeW extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
if (from >= s.length())
/** Matches a character that is not a Unicode alphanumeric or underscore. */
class NUnicodeW extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
if (from >= s.length())
/** Matches a Unicode decimal digit. */
class UnicodeDigit extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && Prop.isDecimalDigit(s.charAt(from)) ? to
/** Matches a character that is not a Unicode digit. */
class NUnicodeDigit extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && !Prop.isDecimalDigit(s.charAt(from)) ? to
/** Matches a Unicode math character. */
class UnicodeMath extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && Prop.isMath(s.charAt(from)) ? to : -1;
/** Matches a non-math Unicode character. */
class NUnicodeMath extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && !Prop.isMath(s.charAt(from)) ? to : -1;
/** Matches a Unicode currency symbol. */
class UnicodeCurrency extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && Prop.isCurrency(s.charAt(from)) ? to : -1;
/** Matches a non-currency symbol Unicode character. */
class NUnicodeCurrency extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && !Prop.isCurrency(s.charAt(from)) ? to : -1;
/** Matches a Unicode alphabetic character. */
class UnicodeAlpha extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && Prop.isAlphabetic(s.charAt(from)) ? to : -1;
/** Matches a non-alphabetic Unicode character. */
class NUnicodeAlpha extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && !Prop.isAlphabetic(s.charAt(from)) ? to
/** Matches an upper case Unicode character. */
class UnicodeUpper extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && isUpper(s.charAt(from)) ? to : -1;
/** Matches an upper case Unicode character. */
class UnicodeLower extends UniValidator
{
+ @Override
public int validate(StringLike s, int from, int to)
{
return from < s.length() && isLower(s.charAt(from)) ? to : -1;
*/
public class Regex extends RegRes implements FilenameFilter
{
+
+ static
+ {
+ /**
+ * @j2sNative
+ *
+ * swingjs.JSUtil.loadStaticResource$S("core/core_stevesoft.z.js");
+ */
+ }
+
/**
* BackRefOffset gives the identity number of the first pattern. Version 1.0
* used zero, version 1.1 uses 1 to be more compatible with perl.
/** Essentially clones the Regex object */
public Regex(Regex r)
{
- super((RegRes) r);
+ super(r);
dontMatchInQuotes = r.dontMatchInQuotes;
esc = r.esc;
ignoreCase = r.ignoreCase;
* patterns are equal as well as the most recent match. If a Regex is compare
* with a RegRes, only the result of the most recent match is compared.
*/
+ @Override
public boolean equals(Object o)
{
if (o instanceof Regex)
}
/** A clone by any other name would smell as sweet. */
+ @Override
public Object clone()
{
return new Regex(this);
{
try
{
- return (Regex) getClass().newInstance();
+ return getClass().newInstance();
} catch (InstantiationException ie)
{
return null;
{
if (p instanceof Any && p.next == null)
{
- return (Pattern) new DotMulti(lo, hi);
+ return new DotMulti(lo, hi);
}
return RegOpt.safe4fm(p) ? (Pattern) new FastMulti(lo, hi, p)
: (Pattern) new Multi(lo, hi, p);
* representations. Also be prepared to see some strange output if your
* characters are not printable.
*/
+ @Override
public String toString()
{
if (false && thePattern == null)
*
* @see com.stevesoft.pat.FileRegex
*/
+ @Override
public boolean accept(File dir, String s)
{
return search(s);