/** * All matchers have the state used by Pattern during a match. */ Matcher(Pattern parent, CharSequence text) { pattern = parent; matcher = new regexodus.Matcher(parent.internal, text); }
/** * Returns a target-less matcher. * Don't forget to supply a target. */ public Matcher matcher() { return new Matcher(this); }
public Matcher copy() { Matcher m = new Matcher(re, cache); m.wEnd = this.wEnd; m.wOffset = this.wOffset; m.called = this.called; m.offset = this.offset; m.end = this.end; return m; }
public Matcher copy() { Matcher m = new Matcher(re, cache); m.wEnd = this.wEnd; m.wOffset = this.wOffset; m.called = this.called; m.offset = this.offset; m.end = this.end; return m; }
/** * Returns a target-less matcher. * Don't forget to supply a target. */ public Matcher matcher() { return new Matcher(this); }
Matcher(Pattern parent, CharSequence text) { this.pattern = parent; this.internalPattern = parent.i; this.text = text; this.matcher = new regexodus.Matcher(internalPattern, text); }
/** * 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; }
/** * 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; }
/** * Returns a matcher for a specified string. */ public Matcher matcher(CharSequence s) { Matcher m = new Matcher(this); m.setTarget(s); return m; }
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; }
/** * 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; }
boolean matchLimited = limit > 0; ArrayList<String> matchList = new ArrayList<String>(); regexodus.Matcher m = new regexodus.Matcher(internal, input);
/** * Returns a matcher for a match result (in a performance-friendly way). * <code>groupId</code> parameter specifies which group is a target. * * @param groupId which group is a target; either positive integer(group id), or one of MatchResult.MATCH,MatchResult.PREFIX,MatchResult.SUFFIX,MatchResult.TARGET. */ public Matcher matcher(MatchResult res, int groupId) { Matcher m = new Matcher(this); if (res instanceof Matcher) { m.setTarget((Matcher) res, groupId); } else { m.setTarget(res.targetChars(), res.start(groupId) + res.targetStart(), res.length(groupId)); } return m; }
/** * Returns a matcher for a match result (in a performance-friendly way). * <code>groupId</code> parameter specifies which group is a target. * * @param groupId which group is a target; either positive integer(group id), or one of MatchResult.MATCH,MatchResult.PREFIX,MatchResult.SUFFIX,MatchResult.TARGET. */ public Matcher matcher(MatchResult res, int groupId) { Matcher m = new Matcher(this); if (res instanceof Matcher) { m.setTarget((Matcher) res, groupId); } else { m.setTarget(res.targetChars(), res.start(groupId) + res.targetStart(), res.length(groupId)); } return m; }