Package org.apache.oro.text.regex

Examples of org.apache.oro.text.regex.Perl5Compiler.compile()


      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);
      }
View Full Code Here


      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 {
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

  public void setPattern(String pattern)
  {
    if (pattern != null) {
      try {
        Perl5Compiler compiler = new Perl5Compiler();
        _pattern = compiler.compile(pattern);
      } catch (MalformedPatternException mpe) {
        throw new ConfigurationError(mpe.toString());
      }
    } else {
      _pattern = null;
View Full Code Here

    if (DebugFile.trace) {
      DebugFile.writeln(String.valueOf(sHtml.length())+" characters readed from file "+sBasePath+sFilePath);
    }
   
      if (oMatcher.contains(sHtml, oCompiler.compile("<meta\\x20+http-equiv=(\"|')?Content-Type(\"|')?\\x20+content=(\"|')?text/html;\\x20+charset=(\\w|-){3,32}(\"|')?>",Perl5Compiler.CASE_INSENSITIVE_MASK))) {
        if (DebugFile.trace) DebugFile.writeln("<meta http-equiv> tag found");
        String sHttpEquiv = oMatcher.getMatch().toString();
        int iCharset = Gadgets.indexOfIgnoreCase(sHttpEquiv,"charset=");
        if (iCharset>0) {
          int iQuoute = sHttpEquiv.indexOf('"', iCharset);
View Full Code Here

        sEncoding = new CharacterSetDetector().detect(oHtmlStrm,"ASCII");
        oHtmlStrm.close();
        if (DebugFile.trace) DebugFile.writeln("Encoding set to "+sEncoding);
      }
     
      Pattern oPattern = oCompiler.compile("<base(\\x20)+href=(\"|')?([^'\"\\r\\n]+)(\"|')?(\\x20)*/?>", Perl5Compiler.CASE_INSENSITIVE_MASK);
    if (oMatcher.contains(sHtml, oPattern)) {
      sBaseHref = Gadgets.chomp(oMatcher.getMatch().group(3),"/");
      if (DebugFile.trace) DebugFile.writeln("<base href="+sBaseHref+">");
    }
 
View Full Code Here

      sBaseHref = Gadgets.chomp(oMatcher.getMatch().group(3),"/");
      if (DebugFile.trace) DebugFile.writeln("<base href="+sBaseHref+">");
    }
 
      PatternMatcherInput oMatchInput = new PatternMatcherInput(sHtml);
    oPattern = oCompiler.compile("\\x20(src=|background=|background-image:url\\x28)(\"|')?([^'\"\\r\\n]+)(\"|')?(\\x20|\\x29|/|>)", Perl5Compiler.CASE_INSENSITIVE_MASK);
    StringSubstitution oSrcSubs = new StringSubstitution();
    int nMatches = 0;
    while (oMatcher.contains(oMatchInput, oPattern)) {
      nMatches++;
      String sMatch = oMatcher.getMatch().toString();
View Full Code Here

      if (!oFiles.contains(sSrc)) oFiles.add(sSrc);
      String sFilename = sSrc.substring(sSrc.replace('\\','/').lastIndexOf('/')+1);
      if (DebugFile.trace)
        DebugFile.writeln("StringSubstitution.setSubstitution("+sMatch+" replace with "+sMatch.substring(0,sAttr.length()+1)+sQuo+sFilename+sQuo+sEnd+")");
      oSrcSubs.setSubstitution(sMatch.substring(0,sAttr.length()+1)+sQuo+sFilename+sQuo+sEnd);
        sHtml = Util.substitute(oReplacer, oCompiler.compile(sMatch), oSrcSubs, sHtml, Util.SUBSTITUTE_ALL);
    } //wend
   
    oMatchInput = new PatternMatcherInput(sHtml);
    oPattern = oCompiler.compile("<link\\x20+(rel=(\"|')?stylesheet(\"|')?\\x20+)?(type=(\"|')?text/css(\"|')?\\x20+)?href=(\"|')?([^'\"\\r\\n]+)(\"|')?");
    while (oMatcher.contains(oMatchInput, oPattern)) {
View Full Code Here

      oSrcSubs.setSubstitution(sMatch.substring(0,sAttr.length()+1)+sQuo+sFilename+sQuo+sEnd);
        sHtml = Util.substitute(oReplacer, oCompiler.compile(sMatch), oSrcSubs, sHtml, Util.SUBSTITUTE_ALL);
    } //wend
   
    oMatchInput = new PatternMatcherInput(sHtml);
    oPattern = oCompiler.compile("<link\\x20+(rel=(\"|')?stylesheet(\"|')?\\x20+)?(type=(\"|')?text/css(\"|')?\\x20+)?href=(\"|')?([^'\"\\r\\n]+)(\"|')?");
    while (oMatcher.contains(oMatchInput, oPattern)) {
      nMatches++;
      String sMatch = oMatcher.getMatch().toString();
      String sSrc = oMatcher.getMatch().group(8);
      String sFilename = sSrc.substring(sSrc.replace('\\','/').lastIndexOf('/')+1);
View Full Code Here

      String sFilename = sSrc.substring(sSrc.replace('\\','/').lastIndexOf('/')+1);
      if (!oFiles.contains(sSrc)) oFiles.add(sSrc);
      if (DebugFile.trace)
        DebugFile.writeln("StringSubstitution.setSubstitution("+sMatch+" replace with "+Gadgets.replace(sMatch, sSrc, sFilename)+")");
      oSrcSubs.setSubstitution(Gadgets.replace(sMatch, sSrc, sFilename));
        sHtml = Util.substitute(oReplacer, oCompiler.compile(sMatch), oSrcSubs, sHtml);    
    } // wend   
   
    if (DebugFile.trace) {
      DebugFile.writeln(String.valueOf(nMatches)+" matches found");
      DebugFile.write("\n"+sHtml+"\n");
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.