Package org.apache.regexp

Examples of org.apache.regexp.RE


  {
    mPrefix = prefix;

    try {
      if ((fragmentStartRegex != null) && (fragmentStartRegex.length() != 0)) {
        mFragmentStartRE = new RE(fragmentStartRegex, RE.MATCH_CASEINDEPENDENT);
        mFragmentStartRegex = fragmentStartRegex;
      }
      if ((fragmentEndRegex != null) && (fragmentEndRegex.length() != 0)) {
        mFragmentEndRE = new RE(fragmentEndRegex, RE.MATCH_CASEINDEPENDENT);
        mFragmentEndRegex = fragmentEndRegex;
      }
    }
    catch (RESyntaxException exc) {
      throw new RegainException("Syntax error in regular expression", exc);
View Full Code Here


        throw new RegainException("Error in ExternalPreparator config: No " +
                "commandLine defined in command section #" + (i + 1));
      }

      try {
        mUrlRegexArr[i] = new RE(urlPattern);
      }
      catch (RESyntaxException exc) {
        throw new RegainException("Error in ExternalPreparator config: " +
                "urlPattern has wrong syntax: " + urlPattern, exc);
      }
View Full Code Here

   * @throws RegainException If the regex couldn't be created.
   */
  private static RE createAcceptRegex() throws RegainException {
    String regex = "(^http://[^/]*/?$)|(^http://.*/[^\\.]*$)|(^http://.*/$)|(\\.(html|htm|jsp|php\\d?|asp)$)";
    try {
      return new RE(regex, RE.MATCH_CASEINDEPENDENT);
    } catch (RESyntaxException exc) {
      throw new RegainException("Creating accept regex for preparator failed: " + regex, exc);
    }
  }
View Full Code Here

    */
   public String getHTMLname (String docID)
   {
     String docName = null;
try {
  RE r = new RE("xml$");
  docName = r.subst (docID,"html");
}
catch (Exception e) {
  e.printStackTrace();
}
  return (docName);
View Full Code Here

  // Check if the directory structure exists...
  fileHandler.createDocDir (docID, this.imgDir + "/");

  // We are going to store the image with the same directory structure
  // of the document
  RE r = new RE("([:alnum:]*).xml$");
  imgPath = r.subst (docID,"");

  uploadImg = this.initValues.readValue ("HTTP Parameters", "art_image");
  if ( uploadImg == null ) {
    // Nothing downloaded...
    return (null);
View Full Code Here

    */
   public String showTextEditor(Document newsDoc, String mode, String browserType)
   {
     String templateFile = "/editor.xsl";
try {
  RE r = new RE("MSIE");
     if ( mode.equals ("rich") && (r.match (browserType)) ) {
    // You must use IE and enable the rich content edition
    // if you want to use this feature :-)
    templateFile = "/editor-ie.xsl";

    // We also will try to escape special characters in the doc
View Full Code Here

 
  NameExpression(String regexp) {

    this.regexp = regexp;
    try {
      re = new RE(regexp);
    }
    catch (RESyntaxException e) {
      throw new IllegalArgumentException("NameExpression: " + regexp + " is not a valid regexp." + e.toString());
    }
  }
View Full Code Here

  }

  private RE getRE() {
    try {
      if (re == null)
        re = new RE(regexp);
    }
    catch (RESyntaxException cannotB) {
      throw new Error("NameExpression.getRE: regezp was not verified");
    }
    return re;
View Full Code Here

    if (regexp == null) {
      re = null;
    }
    else {
      try {
        re = new RE(regexp);
      }
      catch (RESyntaxException e) {
        throw new IllegalArgumentException("NameExpression: " + regexp + " is not a valid regexp." +
            e.toString());
      }
View Full Code Here

    return result;
  }

  public static boolean isMatch(String parten, String str) {
    if (parten != null && str != null) {
      RE re = new RE(parten);
      return re.match(str);
    }

    return false;
  }
View Full Code Here

TOP

Related Classes of org.apache.regexp.RE

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.