Package org.apache.regexp

Examples of org.apache.regexp.RE


   * @param pattern a regular expression that this rule matches
   */
  public void setPattern(String pattern)
    throws RESyntaxException
  {
    this.expression = new RE(pattern);
    this.pattern = pattern;
  }
View Full Code Here


                new ActionError("error.editSection.propertyMissing");
              errors.add("META_" + tname, error);
            }
          } else {
            if (prop.getRegexp() != null) {
              RE re = new RE(prop.getRegexp());
              if (!re.match(value)) {
                ActionError error =
                  new ActionError("error.editSection.propertyMalformed", prop.getErrorMessage());
                errors.add("META_" + tname, error);
              }
            }
View Full Code Here

   */
  public ExecuterParser() throws RegainException {
    try {
      // NOTE: The regex objects are not static in order to be able to use
      //       several ExecuterParser instances in concurrent threads
      mIncludeRegex = new RE("<%@include\\s*file=\"([^\"]*)\"\\s*%>");
      mJspCodeRegex = new RE("<%([^%]*)%>");
      mJspTagRegex = new RE("<([\\w/]*):(\\w*)(([^>\"]*\"[^\"]*\")*\\w*/?)>");
      mParamRegex = new RE("(\\w+)\\s*=\\s*\"([^\"]*)\"");
    } catch (RESyntaxException exc) {
      throw new RegainException("Creating the ExecuterParser regexes failed", exc);
    }
  }
View Full Code Here

          prep.init(preparatorSettingsArr[i].getPreparatorConfig());
         
          // Set the url regex
          String urlRegexAsString = preparatorSettingsArr[i].getUrlRegex();
          if (urlRegexAsString != null) {
            RE urlRegex;
            try {
              urlRegex = new RE(urlRegexAsString);
            }
            catch (RESyntaxException exc) {
              throw new RegainException("urlRegex of preparator " + prepClassName
                  + " has wrong syntax", exc);
            }
View Full Code Here

    if (node != null) {
      Node[] nodeArr = XmlToolkit.getChildArr(node, "auxiliaryField");
      mAuxiliaryFieldArr = new AuxiliaryField[nodeArr.length];
      for (int i = 0; i < nodeArr.length; i++) {
        String fieldName = XmlToolkit.getAttribute(nodeArr[i], "name", true);
        RE urlRegex = readRegexChild(nodeArr[i]);
        String value = XmlToolkit.getAttribute(nodeArr[i], "value");
        boolean toLowerCase = XmlToolkit.getAttributeAsBoolean(nodeArr[i],
                "toLowerCase", true);
        int urlRegexGroup = XmlToolkit.getAttributeAsInt(nodeArr[i], "regexGroup", -1);
        if ((value == null) && (urlRegexGroup == -1)) {
View Full Code Here

              "caseSensitive", false);
          String regex = XmlToolkit.getText(regexNode, true);

          int flags = caseSensitive ? RE.MATCH_NORMAL : RE.MATCH_CASEINDEPENDENT;
          try {
              return new RE(regex, flags);
          } catch (RESyntaxException exc) {
              throw new RegainException("Regex of node '" + node.getNodeName()
                  + "' has a wrong syntax: '" + regex + "'", exc);
          }
      } else {
          // This is the old style -> Use the text as regex
          String regex = XmlToolkit.getText(node, true);
          try {
              return new RE(regex, RE.MATCH_CASEINDEPENDENT);
          } catch (RESyntaxException exc) {
              throw new RegainException("Regex of node '" + node.getNodeName()
                  + "' has a wrong syntax: '" + regex + "'", exc);
          }
      }
View Full Code Here

    */
   public String addSlashes (String in)
   {
  String out = null;
try {
  RE r = new RE("'")
  out = r.subst (in, "\\'");

} catch (Exception e) {
  e.printStackTrace();
}
  return (out);
View Full Code Here

    */
   public String removeSlashes (String in)
   {
  String out = null;
try {
  RE r = new RE("\\'")
  out = r.subst (in, "'");

} catch (Exception e) {
  e.printStackTrace();
}
  return (out);
View Full Code Here

   {
try {
     // We use this regular expresion in order to match xml files
  // if the docName string doesn�t include the "/" string is because
  // is not a normal document
  RE r = new RE("/");
  if ( r.match (docName) ) {

    StringTokenizer token =  new StringTokenizer (docName,"/");
    // We have strings with the format /yyyy/mm/dd/file.xml

    String yearDir = path + token.nextToken();
View Full Code Here

      mUseLinkTextAsTitleReArr = new RE[0];
    } else {
      mUseLinkTextAsTitleReArr = new RE[useLinkTextAsTitleRegexArr.length];
      for (int i = 0; i < useLinkTextAsTitleRegexArr.length; i++) {
        try {
          mUseLinkTextAsTitleReArr[i] = new RE(useLinkTextAsTitleRegexArr[i]);
        }
        catch (RESyntaxException exc) {
          throw new RegainException("Regular expression of "
            + "use-link-text-as-title-pattern #" + i + " has wrong syntax '"
            + useLinkTextAsTitleRegexArr[i] + "'", exc);
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.