Package java.util.regex

Examples of java.util.regex.Pattern.matcher()


                                        name.equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_TEXT||
                                        name.equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_LOCAL_MEDIA) ||
                                        name.equals(CrawlSwitchboard.CRAWL_PROFILE_SNIPPET_GLOBAL_MEDIA) ||
                                        name.equals(CrawlSwitchboard.CRAWL_PROFILE_SURROGATE))
                                    continue;
                                if (compiledPattern.matcher(name).find()) sb.crawler.removeActive(entry.handle().getBytes());
                            }
                        } else {
                            // iterating through the list of URLs
                            final Iterator<Request> iter = sb.crawlQueues.noticeURL.iterator(NoticedURL.StackType.CORE);
                            Request entry;
View Full Code Here


                                        break location;
                                    case MODIFIED:  value = daydate(entry.appdate()); break location;
                                    default: value = null; break location;
                                }
                               
                                if (value != null && compiledPattern.matcher(value).matches()) removehashes.add(entry.url().hash());
                            }
                            Log.logInfo("IndexCreateWWWLocalQueue", "created a remove list with " + removehashes.size() + " entries for pattern '" + pattern + "'");
                            for (final byte[] b: removehashes) {
                                sb.crawlQueues.noticeURL.removeByURLHash(b);
                            }
View Full Code Here

    String line;
    while ((line = br.readLine()) != null) {
      if (p_comment.matcher(line).find()) {
        continue;
      }
      m = p_parameter.matcher(line);
      if (m.find() && (m.groupCount() == 6)) {
        GridParameter p = new GridParameter(Integer.parseInt(m.group(3)), m.group(4), m.group(6),
            m.group(5));
        getDiscipline(Integer.parseInt(m.group(1))).getCategory(
            Integer.parseInt(m.group(2))).setParameter(p);
View Full Code Here

          Pattern fromPattern = Pattern.compile(FROM__PATTERN);
          Matcher matcher;

          do {
            log.debug("scanning from " + String.valueOf(offset) + " to " + String.valueOf(offset+size));
            matcher = fromPattern.matcher(cb);
            while (matcher.find()) {
                // log.debug("Found match at [" + String.valueOf(offset+matcher.start()) + "]");

                // add one (1) to position to account for newline..
                posList.add(new Long(offset+matcher.start() + 1));
View Full Code Here

    return exit;
  }

  private String[] parse(String command) {
    Pattern pattern = Pattern.compile("\"([^\"]*)\"|(\\S+)");
    Matcher matcher = pattern.matcher(command);
    List<String> tokens = new ArrayList<String>();
    while (matcher.find()) {
      if (matcher.group(1) != null) {
        tokens.add(matcher.group(1));
      }
View Full Code Here

    regex = regex.replaceAll("\\\\c","[\\\\w.:-]");
    regex = regex.replaceAll("\\\\C","[^\\\\w.:-]");
    regex = regex.replaceAll("\\\\i","[\\\\p{Alpha}:_]");
    regex = regex.replaceAll("\\\\I","[^\\\\p{Alpha}:_]");
    Pattern p = Pattern.compile(regex);
    boolean valid = p.matcher(value).matches();
    return valid;
  }
 
}
View Full Code Here

      if (dt!=null) object.addProperty(RDF.value, dt);
    }
    else if (type.endsWith("#ENTITY")) {
      DocumentType doctype = elem.getOwnerDocument().getDoctype();
      Pattern entityPattern = Pattern.compile("<!ENTITY\\s+"+value+"\\s+'(.*)'>");
      Matcher match = entityPattern.matcher(doctype.getInternalSubset());
      if (match.find()) value = match.group(1);
      Literal l = m.createTypedLiteral(value,RDF.getURI()+"XMLLiteral");
      stmt = m.createStatement(subject,prop,l);
    }
    else { // schema datatype?
View Full Code Here

   */
  public static String highlightStarEnclosedText(String text, String pre, String post){
    try{
      String srcText = text;
      Pattern p = Pattern.compile("(.*)\\*(\\S+)\\*(.*)");
      Matcher m = p.matcher(text);
      while(m.matches()){
        srcText = m.replaceFirst("$1" + pre+"$2"+post + "$3");
        m = p.matcher(srcText);
      }
      return srcText;
View Full Code Here

      String srcText = text;
      Pattern p = Pattern.compile("(.*)\\*(\\S+)\\*(.*)");
      Matcher m = p.matcher(text);
      while(m.matches()){
        srcText = m.replaceFirst("$1" + pre+"$2"+post + "$3");
        m = p.matcher(srcText);
      }
      return srcText;
    }catch(Exception e){
     
    }
View Full Code Here

    {
      Pattern pattern = node.compile(parg, farg);
      if (pattern == null) {
        throw new ValueExprEvaluationException();
      }
      boolean result = pattern.matcher(arg.stringValue()).find();
      return BooleanLiteralImpl.valueOf(result);
    }

    throw new ValueExprEvaluationException();
  }
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.