/** * Reports the end index (exclusive) of this matcher's region. * The searches this matcher conducts are limited to finding matches * within {@link #regionStart regionStart} (inclusive) and * {@link #regionEnd regionEnd} (exclusive). * * @return the ending point of this matcher's region * @since 1.5 */ public int regionEnd() { return matcher.targetEnd(); }
public int regionEnd() { return matcher.targetEnd(); }
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 boolean find(int start) { int limit = matcher.targetEnd(); if ((start < 0) || (start > limit)) throw new IndexOutOfBoundsException("Illegal start index"); reset(); matcher.setPosition(start); return matcher.find(); }
/** * Resets this matcher and then attempts to find the next subsequence of * the input sequence that matches the pattern, starting at the specified * index. * * <p> If the match succeeds then more information can be obtained via the * <tt>start</tt>, <tt>end</tt>, and <tt>group</tt> methods, and subsequent * invocations of the {@link #find()} method will start at the first * character not matched by this match. </p> * * @throws IndexOutOfBoundsException * If start is less than zero or if start is greater than the * length of the input sequence. * * @return <tt>true</tt> if, and only if, a subsequence of the input * sequence starting at the given index matches this matcher's * pattern */ public boolean find(int start) { int limit = matcher.targetEnd(); if ((start < 0) || (start > limit)) throw new IndexOutOfBoundsException("Illegal start index"); reset(); matcher.setPosition(start); return matcher.find(); }