Package org.apache.oro.text.regex

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


  /// @param pattern Regular expression to match with
  /// @return New sequence containing selected elements
  public static final Object[] p_grep = new Object[] { null, "pattern" };
  public Any m_grep(Context context, Any pattern_)
  {
    Pattern pattern = ObjectPool.createPattern(context, pattern_);
    Perl5Matcher matcher = new Perl5Matcher();
    AnySequence matched = createEmptySequence();
    int size = getSize();
    for(int i=0; i<size; i++) {
      Any element = getElement(i);
View Full Code Here


    throws ArrayIndexOutOfBoundsException,MalformedPatternException {
  String sAllowPattern, sDenyPattern;
    ArrayList<String> oRecipientsWithoutDuplicates;
    boolean bAllowed;

  Pattern oAllowPattern=null, oDenyPattern=null;
  Perl5Matcher oMatcher = new Perl5Matcher();
  Perl5Compiler oCompiler = new Perl5Compiler();
   
    if (aEMails!=null) {
      if (aEMails.length>0) {
View Full Code Here

          oDocumentImages.put(sSrc, sCid);
        } // fi (!oDocumentImages.containsKey(sSrc))

        try {
          Pattern oPattern = oCompiler.compile(sSrc, Perl5Compiler.SINGLELINE_MASK);
          oSrcSubs.setSubstitution("cid:"+oDocumentImages.get(sSrc));
          if (DebugFile.trace) DebugFile.writeln("Util.substitute([PatternMatcher],"+ sSrc + ",cid:"+oDocumentImages.get(sSrc)+",...)");
          sHtmlBody = Util.substitute(oMatcher, oPattern, oSrcSubs, sHtmlBody);
        } catch (MalformedPatternException neverthrown) { }
View Full Code Here

    final String sPattern = "("+sAttributeName.toLowerCase()+"|"+sAttributeName.toUpperCase()+"|"+sAttributeName+")\\s*=\\s*(\"|')?" + sFormerValue + "(\"|')?";

    try {

      if (DebugFile.trace) DebugFile.writeln("Perl5Compiler.compile(\""+sPattern+"\", Perl5Compiler.SINGLELINE_MASK)");
      Pattern oPattern = oCompiler.compile(sPattern, Perl5Compiler.SINGLELINE_MASK);

      if (oMatcher.contains(sBase, oPattern)) {
        MatchResult oMtrs = oMatcher.getMatch();
        if (oMtrs!=null) sMatch = oMtrs.toString();
        if (sMatch.length()==0) {
View Full Code Here

    if (extended) {
      buffer.append('x');
    }
    String key = buffer.toString();
     
    Pattern pat = (Pattern)_patterns.get(key);

    if (pat == null) {
      int flags =
        Perl5Compiler.READ_ONLY_MASK |
        (ignoreCase ? Perl5Compiler.CASE_INSENSITIVE_MASK : 0) |
View Full Code Here

      if (matches_ instanceof AnyList) {
        list = (AnyList)matches_;
      }
    }
   
    Pattern pattern = ObjectPool.createPattern(context, pattern_);
    Perl5Matcher matcher = new Perl5Matcher();
    if (isMatch ? matcher.matches(_string, pattern)
                : matcher.contains(_string, pattern))
    {
      if (array != null) {
View Full Code Here

  /// @return Enumeration of strings
  /// @throws MalformedPattern If pattern is invalid
  public static final Object[] p_find = new Object[] { null, "pattern" };
  public Any m_find(Context context, Any pattern_)
  {
    Pattern pattern = ObjectPool.createPattern(context, pattern_);
    return new AnyBindingEnumeration(
      new AnyUtils.StringPatternMatcher(pattern, _string));
  }   
View Full Code Here

  /// @param pattern Regular expression pattern
  /// @throws MalformedPattern If pattern is invalid
  public static final Object[] p_split = new Object[] { null, "pattern" };
  public Any m_split(Context context, Any pattern_)
  {
    Pattern pattern = ObjectPool.createPattern(context, pattern_);
    Perl5Matcher matcher = new Perl5Matcher();
    Vector parts = Util.split(matcher, pattern, _string);
    int n = parts.size();
    Any[] list = new Any[n];
    for(int i=0; i<n; i++) {
View Full Code Here

      }
    } else {
      substitution = new AnyUtils.FunctionSubstitute(context, replacement);
    }
   
    Pattern pattern = ObjectPool.createPattern(context, pattern_);
    Perl5Matcher matcher = new Perl5Matcher();
    return Any.create(Util.substitute(matcher, pattern, substitution, _string, flags));
  }
View Full Code Here

  /* regular expressions */

  public static final boolean match(Context context, Any image, Any pattern)
  {
    Pattern p;
    if (pattern.isPattern()) {
      p = pattern.toPattern();
    } else {
      try {
        p = ObjectPool.createPattern(pattern.toString(), null);
View Full Code Here

TOP

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

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.