Example usage for java.util.regex Matcher useAnchoringBounds

List of usage examples for java.util.regex Matcher useAnchoringBounds

Introduction

In this page you can find the example usage for java.util.regex Matcher useAnchoringBounds.

Prototype

public Matcher useAnchoringBounds(boolean b) 

Source Link

Document

Sets the anchoring of region bounds for this matcher.

Usage

From source file:com.github.rwitzel.streamflyer.regex.AbstractRegexModifierTest.java

protected OnStreamMatcher createMatcher(String regex, int flags) {
    Matcher matcher = Pattern.compile(regex, flags).matcher("");
    matcher.useTransparentBounds(true);/*from   ww  w  . j  a  v a  2 s  .  com*/
    matcher.useAnchoringBounds(false);
    return new OnStreamStandardMatcher(matcher);
}

From source file:com.github.rwitzel.streamflyer.experimental.range.RangeFilterModifierTest.java

private RegexModifier createRegexModifier(String regex) {

    Matcher matcher = Pattern.compile(regex, 0).matcher("");
    matcher.useTransparentBounds(true);/*from   w ww .  j  av a 2  s  .c o  m*/
    matcher.useAnchoringBounds(false);
    OnStreamMatcher onStreamMatcher = new OnStreamStandardMatcher(matcher);
    return new RegexModifier(onStreamMatcher, new MatchProcessor() {

        @Override
        public MatchProcessorResult process(StringBuilder characterBuffer, int firstModifiableCharacterInBuffer,
                MatchResult matchResult) {
            throw new UnsupportedOperationException("this match processor must be replaced with another one");
        }
    }, 12, 345);
}

From source file:com.googlecode.streamflyer.regex.OnStreamMatcherPerformanceTest.java

private OnStreamMatcher createMatcher(Class<? extends OnStreamMatcher> onStreamMatcherClass, String regex) {

    if (onStreamMatcherClass.isAssignableFrom(OnStreamJava6Matcher.class)) {
        Matcher matcher = Pattern.compile(regex).matcher("");
        matcher.useTransparentBounds(true);
        matcher.useAnchoringBounds(false);
        return new OnStreamJava6Matcher(matcher);

    } else if (onStreamMatcherClass.isAssignableFrom(OnStreamStandardMatcher.class)) {
        Matcher matcher = Pattern.compile(regex).matcher("");
        matcher.useTransparentBounds(true);
        return new OnStreamStandardMatcher(matcher);
    } else if (onStreamMatcherClass.isAssignableFrom(OnStreamExtendedMatcher.class)) {
        com.googlecode.streamflyer.regex.fast.Matcher matcher = com.googlecode.streamflyer.regex.fast.Pattern
                .compile(regex).matcher("");
        matcher.useTransparentBounds(true);
        return new OnStreamExtendedMatcher(matcher);
    } else {//  w w  w.ja va 2  s. c  o m
        throw new IllegalArgumentException(
                String.format("class %s is not supported or of wrong type", onStreamMatcherClass));
    }
}