public boolean lookingAt() { return matcher.search(regexodus.Matcher.ACCEPT_INCOMPLETE); }
/** * Attempts to match the input sequence, starting at the beginning of the * region, against the pattern. * * <p> Like the {@link #matches matches} method, this method always starts * at the beginning of the region; unlike that method, it does not * require that the entire region be matched. * * <p> If the match succeeds then more information can be obtained via the * <tt>start</tt>, <tt>end</tt>, and <tt>group</tt> methods. </p> * * @return <tt>true</tt> if, and only if, a prefix of the input * sequence matches this matcher's pattern */ public boolean lookingAt() { return matcher.search(regexodus.Matcher.ACCEPT_INCOMPLETE); }
return search(0);
/** * 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); }
/** * Searches through a target for a matching substring, starting from just after the end of last match. * If there wasn't any search performed, starts from zero. * * @return <code>true</code> if a match found. */ public final boolean find() { if (called) skip(); return search(0); }
/** * Searches through a target for a matching substring, starting from just after the end of last match. * If there wasn't any search performed, starts from zero. * * @return <code>true</code> if a match found. */ public final boolean find() { if (called) skip(); return search(0); }
/** * Searches through a target for a matching substring, starting from just after the end of last match. * If there wasn't any search performed, starts from zero. * * @param anchors a zero or a combination(bitwise OR) of ANCHOR_START,ANCHOR_END,ANCHOR_LASTMATCH,ACCEPT_INCOMPLETE * @return <code>true</code> if a match found. */ public boolean find(int anchors) { if (called) skip(); return search(anchors); }
/** * Searches through a target for a matching substring, starting from just after the end of last match. * If there wasn't any search performed, starts from zero. * * @param anchors a zero or a combination(bitwise OR) of ANCHOR_START,ANCHOR_END,ANCHOR_LASTMATCH,ACCEPT_INCOMPLETE * @return <code>true</code> if a match found. */ public boolean find(int anchors) { if (called) skip(); return search(anchors); }
/** * Tells whether a current target matches the whole pattern. * For example the following yields the <code>true</code>:<pre> * Pattern p=new Pattern("\\w+"); * p.matcher("a").matches(); * p.matcher("ab").matches(); * p.matcher("abc").matches(); * </pre> * and the following yields the <code>false</code>:<pre> * p.matcher("abc def").matches(); * p.matcher("bcd ").matches(); * p.matcher(" bcd").matches(); * p.matcher("#xyz#").matches(); * </pre> * * @return whether a current target matches the whole pattern. */ public final boolean matches() { if (called) setPosition(0); return search(ANCHOR_START | ANCHOR_END); }
/** * Tells whether a current target matches the whole pattern. * For example the following yields the <code>true</code>:<pre> * Pattern p=new Pattern("\\w+"); * p.matcher("a").matches(); * p.matcher("ab").matches(); * p.matcher("abc").matches(); * </pre> * and the following yields the <code>false</code>:<pre> * p.matcher("abc def").matches(); * p.matcher("bcd ").matches(); * p.matcher(" bcd").matches(); * p.matcher("#xyz#").matches(); * </pre> * * @return whether a current target matches the whole pattern. */ public final boolean matches() { if (called) setPosition(0); return search(ANCHOR_START | ANCHOR_END); }
/** * Tells whether the entire target matches the beginning of the pattern. * The whole pattern is also regarded as its beginning.<br> * This feature allows to find a mismatch by examining only a beginning part of * the target (as if the beginning of the target doesn't match the beginning of the pattern, then the entire target * also couldn't match).<br> * For example the following assertions yield <code>true</code>:<pre> * Pattern p=new Pattern("abcd"); * p.matcher("").matchesPrefix(); * p.matcher("a").matchesPrefix(); * p.matcher("ab").matchesPrefix(); * p.matcher("abc").matchesPrefix(); * p.matcher("abcd").matchesPrefix(); * </pre> * and the following yield <code>false</code>:<pre> * p.matcher("b").isPrefix(); * p.matcher("abcdef").isPrefix(); * p.matcher("x").isPrefix(); * </pre> * * @return true if the entire target matches the beginning of the pattern */ public final boolean matchesPrefix() { setPosition(0); return search(ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END); }
/** * Tells whether the entire target matches the beginning of the pattern. * The whole pattern is also regarded as its beginning.<br> * This feature allows to find a mismatch by examining only a beginning part of * the target (as if the beginning of the target doesn't match the beginning of the pattern, then the entire target * also couldn't match).<br> * For example the following assertions yield <code>true</code>:<pre> * Pattern p=new Pattern("abcd"); * p.matcher("").matchesPrefix(); * p.matcher("a").matchesPrefix(); * p.matcher("ab").matchesPrefix(); * p.matcher("abc").matchesPrefix(); * p.matcher("abcd").matchesPrefix(); * </pre> * and the following yield <code>false</code>:<pre> * p.matcher("b").isPrefix(); * p.matcher("abcdef").isPrefix(); * p.matcher("x").isPrefix(); * </pre> * * @return true if the entire target matches the beginning of the pattern */ public final boolean matchesPrefix() { setPosition(0); return search(ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END); }