Examples of Perl5Matcher


Examples of com.dotcms.repackage.org.apache.oro.text.regex.Perl5Matcher

    return newBody.toString();
  }

  public void updateParseContainerSyntax(Template template) {
    String tb = template.getBody();
    Perl5Matcher matcher = (Perl5Matcher) localP5Matcher.get();
    String oldParse;
    String newParse;
      while(matcher.contains(tb, parseContainerPattern)){
         MatchResult match = matcher.getMatch();
        int groups = match.groups();
         for(int g=0;g<groups;g++){
           oldParse = match.group(g);
           if(matcher.contains(oldParse, oldContainerPattern)){
             MatchResult matchOld = matcher.getMatch();
             newParse = matchOld.group(0).trim();
             newParse = containerTag + newParse + "')";
             tb = StringUtil.replace(tb,oldParse,newParse);
           }
         }
View Full Code Here

Examples of com.sun.star.tool.starjar.regex.Perl5Matcher

        catch (MalformedPatternException e) {
            System.out.println("Fehler beim Parsen der Filterdatei :\n" + e);
        }

        PatternCompiler compiler = new Perl5Compiler();
        PatternMatcher matcher = new Perl5Matcher();
       
        while (fileList.hasMoreElements()) {
            FileListElement file = (FileListElement)fileList.nextElement();
            Enumeration filterEnum = filter.elements();
            Pattern pathPattern = null;
            Pattern filenamePattern = null;
           
            while (filterEnum.hasMoreElements()) {
                FilterElement filterElement = (FilterElement)filterEnum.nextElement();
                try {
                    pathPattern = compiler.compile(filterElement.getPathPattern());
                    filenamePattern = compiler.compile(filterElement.getFilenamePattern());
                } catch (MalformedPatternException e) {
                    System.out.println("Fehler im Pattern\n" + e);
                }
                if (matcher.matches(file.getPath(),pathPattern) && matcher.matches(file.getFilename(),filenamePattern))
                    file.setInclude(filterElement.isInclude());
            }
        }
        starJar.zipFiles(fileListVector,"JarDirectoryTest.jar", "");
    }
View Full Code Here

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

  }

 
  private boolean checkEmail(String email)
  {
    return new Perl5Matcher().matches(email, EMAIL_PATTERN);
  }
View Full Code Here

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

  /// @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);
      if (matcher.contains(element.toString(), pattern)) {
        matched = matched.append(element);
      }
    } 
    return matched;
  }  
View Full Code Here

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

  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) {
        if (aRecipients==null) {
          aRecipients = aEMails;
        } else {
          aRecipients = concatArrays(aRecipients, aEMails);
        } // fi (aRecipients!=null)
        final int nRecipients = aRecipients.length;
        Arrays.sort(aRecipients, String.CASE_INSENSITIVE_ORDER);
   
    oRecipientsWithoutDuplicates = new ArrayList<String>(nRecipients);

      sAllowPattern = getAllowPattern();
      sDenyPattern = getDenyPattern();
     
      if (sAllowPattern.length()>0) {
        oAllowPattern = oCompiler.compile(sAllowPattern, Perl5Compiler.CASE_INSENSITIVE_MASK);
      }

      if (sDenyPattern.length()>0) {
        oDenyPattern = oCompiler.compile(sDenyPattern, Perl5Compiler.CASE_INSENSITIVE_MASK);
      }
       
      for (int r=0; r<nRecipients-1; r++) {
      bAllowed = true;
      try {
        if (sAllowPattern.length()>0) bAllowed &= oMatcher.matches(aRecipients[r], oAllowPattern);
      } catch (ArrayIndexOutOfBoundsException aiob) {
        throw new ArrayIndexOutOfBoundsException("Gadgets.matches("+aRecipients[r]+","+sAllowPattern+")");
      }
      try {
      if (sDenyPattern.length()>0) bAllowed &= !oMatcher.matches(aRecipients[r], oDenyPattern);
      } catch (ArrayIndexOutOfBoundsException aiob) {
        throw new ArrayIndexOutOfBoundsException("Gadgets.matches("+aRecipients[r]+","+sDenyPattern+")");
      }
      if (bAllowed) {
          if (!aRecipients[r].equalsIgnoreCase(aRecipients[r+1])) {
View Full Code Here

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

                                 String sId, String [] aAttachmentsPath,
                                 String sBasePath)
  throws IOException,MessagingException,IllegalArgumentException,SecurityException {

  PatternCompiler oCompiler = new Perl5Compiler();
  PatternMatcher oMatcher = new Perl5Matcher();
 
  String sContentType = (sHtmlBody==null ? "plain" : "html");
 
  if (DebugFile.trace) {
    DebugFile.writeln("Begin SessionHandler.composeMessage("+sSubject+","+sEncoding+",...,"+sId+","+sContentType+")");
View Full Code Here

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

  public void setEmail(String sAttendantEmail)
    throws IllegalArgumentException {

    try {
    if (!new Perl5Matcher().matches(sAttendantEmail, new Perl5Compiler().compile("[\\w\\x2E_-]+@[\\w\\x2E_-]+\\x2E\\D{2,4}",Perl5Compiler.CASE_INSENSITIVE_MASK)))
      throw new IllegalArgumentException("Invalid e-mail syntax");
    } catch (MalformedPatternException neverthrown) { }

    if (sAttendantEmail.length()>100)
      throw new IllegalArgumentException("e-mail may not exceed 100 characters");
View Full Code Here

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

      if (oMatcher.contains(sBase, oPattern)) {
        MatchResult oMtrs = oMatcher.getMatch();
        if (oMtrs!=null) sMatch = oMtrs.toString();
        if (sMatch.length()==0) {
          oCompiler = new Perl5Compiler();
          oMatcher = new Perl5Matcher();
          oPattern = oCompiler.compile(sPattern, Perl5Compiler.SINGLELINE_MASK);
          if (oMatcher.contains(sBase, oPattern)) {
            oMtrs = oMatcher.getMatch();
            if (oMtrs!=nullsMatch = oMtrs.toString();
          }
View Full Code Here

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

  protected Zone accept(String pathinfo, int start)
  {
    if (_pattern != null) {
      PatternMatcherInput input = new PatternMatcherInput(pathinfo, start, pathinfo.length()-start);
      Perl5Matcher matcher = new Perl5Matcher();
      if (matcher.contains(input, _pattern)) {
        return resolveZone(pathinfo, start);
      }
    } else {
      String pi = _pathinfo;
      int pi_length = pi.length();
View Full Code Here

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

        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) {
        MatchResult match = matcher.getMatch();
        array.clear();
        int n = match.groups();
        for(int i=0; i<n; i++) {
          array.append(Any.create(match.group(i)));
        }
        return array;

      } else if (list != null) {
        MatchResult match = matcher.getMatch();
        list.clear();
        int n = match.groups();
        for(int i=0; i<n; i++) {
          list.append(Any.create(match.group(i)));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.