/** * Supplies a text to search in/match with. * Resets current search position to zero. * * @param text - a data * @see Matcher#setTarget(regexodus.Matcher, int) * @see Matcher#setTarget(java.lang.CharSequence, int, int) * @see Matcher#setTarget(char[], int, int) * @see Matcher#setTarget(java.io.Reader, int) */ public void setTarget(CharSequence text) { setTarget(text, 0, text.length()); }
public Matcher reset(CharSequence input) { matcher.setTarget(input); return reset(); }
/** * Supplies a text to search in/match with. * Resets current search position to zero. * * @param text - a data * @see Matcher#setTarget(regexodus.Matcher, int) * @see Matcher#setTarget(java.lang.CharSequence, int, int) * @see Matcher#setTarget(char[], int, int) * @see Matcher#setTarget(java.io.Reader, int) */ public void setTarget(CharSequence text) { setTarget(text, 0, text.length()); }
public Matcher(Pattern regex, CharSequence target) { setPattern(regex); setTarget(target); }
/** * Just a combination of setTarget(String) and matches(). * * @param s the target string; * @return whether the specified string matches the whole pattern. */ public final boolean matches(String s) { setTarget(s); return search(ANCHOR_START | ANCHOR_END); }
/** * Just a combination of setTarget(String) and matches(). * * @param s the target string; * @return whether the specified string matches the whole pattern. */ public final boolean matches(String s) { setTarget(s); return search(ANCHOR_START | ANCHOR_END); }
/** * Returns a matcher for a specified string. */ public Matcher matcher(CharSequence s) { Matcher m = new Matcher(this); m.setTarget(s); return m; }
/** * Returns a matcher for a specified string. */ public Matcher matcher(CharSequence s) { Matcher m = new Matcher(this); m.setTarget(s); return m; }
/** * Returns a matcher for a specified region. */ public Matcher matcher(char[] data, int start, int end) { Matcher m = new Matcher(this); m.setTarget(data, start, end); return m; }
public Matcher(Pattern regex, CharSequence target) { setPattern(regex); setTarget(target); }
/** * Returns a matcher for a specified region. */ public Matcher matcher(char[] data, int start, int end) { Matcher m = new Matcher(this); m.setTarget(data, start, end); return m; }
public Matcher region(int start, int end) { if ((start < 0) || (start > matcher.targetEnd())) throw new IndexOutOfBoundsException("start"); if ((end < 0) || (end > matcher.targetEnd())) throw new IndexOutOfBoundsException("end"); if (start > end) throw new IndexOutOfBoundsException("start > end"); matcher.setTarget(matcher.target(), start, end - start); return this; }
public PerlSubstitution(String s) { Matcher refMatcher = new Matcher(refPtn); refMatcher.setTarget(s); queueEntry = makeQueue(refMatcher); }
public ChanceSubstitution(String s, double chance, long seed) { state += seed; this.chance = chance; Matcher refMatcher = new Matcher(refPtn); refMatcher.setTarget(s); queueEntry = makeQueue(refMatcher); }
public PerlSubstitution(String s) { Matcher refMatcher = new Matcher(refPtn); refMatcher.setTarget(s); queueEntry = makeQueue(refMatcher); }
/** * Returns a matcher taking a text stream as target. * <b>Note that this is not a true POSIX-style stream matching</b>, i.e. the whole length of the text is preliminary read and stored in a char array. * * @param text a text stream * @param length the length to read from a stream; if <code>len</code> is <code>-1</code>, the whole stream is read in. * @throws IOException indicates an IO problem */ @GwtIncompatible public Matcher matcher(Reader text, int length) throws IOException { Matcher m = new Matcher(this); m.setTarget(text, length); return m; }
public static int indexOf(CharSequence text, Pattern regex) { matcher.setPattern(regex); matcher.setTarget(text); if(!matcher.find()) return -1; return matcher.start(); } public static int indexOf(CharSequence text, String regex)
public static int indexOf(CharSequence text, String regex) { matcher.setPattern(Pattern.compile(regex)); matcher.setTarget(text); if(!matcher.find()) return -1; return matcher.start(); }
public static int indexOf(CharSequence text, Pattern regex, int beginIndex) { matcher.setPattern(regex); matcher.setTarget(text); matcher.setPosition(beginIndex); if(!matcher.find()) return -1; return matcher.start(); } public static int indexOf(CharSequence text, String regex, int beginIndex)
public static int indexOf(CharSequence text, String regex, int beginIndex) { matcher.setPattern(Pattern.compile(regex)); matcher.setTarget(text); matcher.setPosition(beginIndex); if(!matcher.find()) return -1; return matcher.start(); } public static int indexOf(CharSequence text, Pattern regex)