Package org.apache.oro.text.regex

Examples of org.apache.oro.text.regex.Perl5Substitution


  public static String replace(String strInput, String strPattern, String replacement, boolean caseSensitive, boolean replaceAll) throws MalformedPatternException {
      return _replace(strInput,strPattern,escape(replacement),caseSensitive,replaceAll);
  }
  private static String _replace(String strInput, String strPattern, String replacement, boolean caseSensitive, boolean replaceAll) throws MalformedPatternException {
    Pattern pattern = getPattern(strPattern, caseSensitive?16:17);
    return Util.substitute(new Perl5Matcher(), pattern, new Perl5Substitution(replacement), strInput, replaceAll ? -1 : 1);
  }
View Full Code Here


     *
     * @return �滻��
     */
    protected Substitution createSubstitution(Substitution reuse, String substitution) {
        if (reuse == null) {
            return new Perl5Substitution(substitution);
        }

        ((Perl5Substitution) reuse).setSubstitution(substitution);
        return reuse;
    }
View Full Code Here

    String bareValue = getBareAttributeValue(entryToInspect);
    String substitutedValue;
    if (getPattern() == null || this.substitute == null) {
      substitutedValue = bareValue;
    } else{
      Perl5Substitution ps = new Perl5Substitution(this.substitute);
      PatternMatcher mtch = new Perl5Matcher();
      substitutedValue = Util.substitute(mtch, getPattern(), ps, bareValue,
                                         Util.SUBSTITUTE_ALL );
    }
    return substitutedValue;
View Full Code Here

            }
        }

        // Do the substitution
        Substitution s =
            new Perl5Substitution(subst.toString(),
                                  Perl5Substitution.INTERPOLATE_ALL);
        return Util.substitute(matcher,
                               getCompiledPattern(options),
                               s,
                               input,
View Full Code Here

     * @param substitution 替换字符串
     * @return 替换器
     */
    protected Substitution createSubstitution(Substitution reuse, String substitution) {
        if (reuse == null) {
            return new Perl5Substitution(substitution);
        }

        ((Perl5Substitution) reuse).setSubstitution(substitution);
        return reuse;
    }
View Full Code Here

    System.out.println(matches);
   
    // substitution
   
    regexpr = compiler.compile("\\b(\\w+)\\b");
    Perl5Substitution sub = new Perl5Substitution("apples");
    System.out.println(Util.substitute(matcher,regexpr,sub,"same same same",Util.SUBSTITUTE_ALL));
   
    // strings

    regexpr = compiler.compile(Perl5Compiler.quotemeta("b"));
View Full Code Here

        }
       

        // Do the substitution
        Substitution s =
            new Perl5Substitution(subst.toString(),
                                  Perl5Substitution.INTERPOLATE_ALL);
        return Util.substitute(matcher,
                               getCompiledPattern(options),
                               s,
                               input,
View Full Code Here

        }


        // Do the substitution
        Substitution s =
            new Perl5Substitution(subst.toString(),
                                  Perl5Substitution.INTERPOLATE_ALL);
        return Util.substitute(matcher,
                               getCompiledPattern(options),
                               s,
                               input,
View Full Code Here

     *
     * @return �滻��
     */
    protected Substitution createSubstitution(Substitution reuse, String substitution) {
        if (reuse == null) {
            return new Perl5Substitution(substitution);
        }

        ((Perl5Substitution) reuse).setSubstitution(substitution);
        return reuse;
    }
View Full Code Here

TOP

Related Classes of org.apache.oro.text.regex.Perl5Substitution

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.