Package java.util.regex

Examples of java.util.regex.Matcher.matches()


   
    s = Pattern.compile("ed2k:\\/\\/\\|server\\|([0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+)\\|([0-65535]*)\\|\\/");
   
    m = s.matcher(link);
   
    return m.matches();
  }
 
  public static List<ED2KServerLink> extractLinks(String rawData) {
   
    Pattern s = Pattern.compile("ed2k:\\/\\/\\|server\\|([0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+.[0-9]{1,3}+)\\|([0-65535]*)\\|\\/");
 
View Full Code Here


   
    Pattern s;
    Matcher m;
    s = Pattern.compile(ED2K_LINK_PATTERN, Pattern.CASE_INSENSITIVE);
    m = s.matcher(fileLink);
    if (m.matches()) {
      this.fileName=m.group(1);
      this.fileSize=Long.valueOf(m.group(2)).longValue();
      this.fileHash = new FileHash(m.group(3));
      this.partHashSet = extractPartHashes(fileHash,m.group(4));
      this.rootHash = m.group(5);
View Full Code Here

        for (Iterator i = uncountables.iterator(); i.hasNext();)
        {
            Pattern pattern = (Pattern)i.next();
            Matcher matcher = pattern.matcher(str);
            if (matcher.matches())
            {
                return str;
            }
        }
View Full Code Here

        {
            Inflection inflection = (Inflection)i.next();
            Pattern pattern = inflection.getPattern();
            String replace = inflection.getReplace();
            Matcher matcher = pattern.matcher(str);
            if (matcher.matches())
            {
                return matcher.replaceFirst(replace);
            }
        }
        return str.replaceFirst("([\\w]+)([^s])$", "$1$2s");
View Full Code Here

  public static boolean isValidLink(String link) {
    Pattern s;
    Matcher m;
    s = Pattern.compile(ED2K_LINK_PATTERN, Pattern.CASE_INSENSITIVE);
    m = s.matcher(link);
    return m.matches();
  }
 
  public String getAsString() {
    StringBuilder sb = new StringBuilder();
    sb.append("ed2k://|file|"+fileName+"|"+fileSize+"|"+fileHash+"|"); // base
View Full Code Here

     */
    public static boolean isConstraintKind(String expression, String kind)
    {
        Pattern pattern = Pattern.compile(".*\\s*" + StringUtils.trimToEmpty(kind) + "\\s*\\w*\\s*:.*", Pattern.DOTALL);
        Matcher matcher = pattern.matcher(StringUtils.trimToEmpty(expression));
        return matcher.matches();
    }
}
View Full Code Here

    //Pattern p = Pattern.compile("/(eta_[0-9]*)/$"); // doesn't match
    Pattern p = Pattern.compile(".*/(eta_[0-9]*)/$"); // matches
    Matcher m = p.matcher("fred/the/eta_211/");
    //boolean b = m.matches();
    if ( m.matches())
    {
      System.out.println( "Matches" );
      System.out.println( "numGroups : " + m.groupCount());
      for ( int i = 0; i <= m.groupCount(); i++)
      {
View Full Code Here

    while (true) {
      line = raf.readLine();
      if (line == null) break;
      if (line.trim().length() == 0) continue;
      Matcher matcher = p.matcher(line);
      return matcher.matches();
    }
    return false;
  }

  @Override
View Full Code Here

        if (line == null) return null;
        if (line.startsWith("#")) continue;
        if (line.trim().length() == 0) continue;
        //System.out.printf("line %s%n", line);
        matcher = vinfo.p.matcher(line);
        if (matcher.matches()) {
          String stnid = matcher.group(stn_fldno).trim();
          if (stnid.equals(stationId)) break;
        }
      }
      recno++;
View Full Code Here

   * @param name test this.
   * @return  true if valid name.
   */
  static public boolean isValidNetcdf3ObjectName(String name) {
    Matcher m = objectNamePattern.matcher(name);
    return m.matches();
  }

  /**
   * Valid Netcdf Object name as a regular expression.
   * @return regular expression pattern describing valid Netcdf Object names.
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.