Package org.apache.regexp

Examples of org.apache.regexp.RE.match()


              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


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

    //       normal fields have the value we expect.
    AuxiliaryField[] auxiliaryFieldArr = mConfig.getAuxiliaryFieldList();
    if (auxiliaryFieldArr != null) {
      for (int i = 0; i < auxiliaryFieldArr.length; i++) {
        RE regex = auxiliaryFieldArr[i].getUrlRegex();
        if (regex.match(url)) {
          String fieldName = auxiliaryFieldArr[i].getFieldName();

          String value = auxiliaryFieldArr[i].getValue();
          if (value == null) {
            // We have no value set -> Extract the value from the regex
View Full Code Here

      boolean shouldBeIndexed = mHtmlParserUrlPatternArr[i].getShouldBeIndexed();

      int offset = 0;
      String contentAsString = rawDocument.getContentAsString();
      try {
        while (re.match(contentAsString, offset)) {
          offset = re.getParenEnd(0);

          String parentUrl = rawDocument.getUrl();
          String url = re.getParen(urlGroup);
View Full Code Here

     Hashtable myParameters = new Hashtable();

try {
  String contentType = this.myRequest.getContentType();
  RE r = new RE("multipart/form-data");
  if ( r.match (" " + contentType) ) {
    // We are dealing with a multipart form
    MultipartRequest formHandler = new MultipartRequest
          (this.myRequest, tmpDir);
    Enumeration paramList = formHandler.getParameterNames();
    for (; paramList.hasMoreElements() ;) {
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

  }

  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

  public static String parseNum(String src) {
    String result = null;
    final String rule = "[0-9��һ�����������߰˾�ʮҼ��������½��ƾ�ʰ]+";
    if (src != null) {
      RE re = new RE(rule);
      if (re.match(src)) {
        result = re.getParen(0);
      }
    }
    return result;
  }
View Full Code Here

      }
      // choose level according to case insensitivity
      re = new RE(c, ignoreCase ? RE.MATCH_CASEINDEPENDENT
          : RE.MATCH_NORMAL);
      // return the matching result of regular expression
      return re.match(string);
    } catch (RESyntaxException e) {
      throw new IllegalArgumentException(e.getMessage());
    }
  }
}
View Full Code Here

      for (int i = 0; i < DISC_REGEXS.length; i++)
      {
        String kDISC_REGEX = DISC_REGEXS[i];

        RE re = new RE(kDISC_REGEX);
        if (re.match(s.toLowerCase()))
        {

          if (re.getParenCount() < 2)
          {
            Debug.debug("Disc missing number", s);
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.