Package java.util.regex

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


        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())
          break;
        System.out.printf("FAIL %s%n", line);
      }
      recno++;
      return new StationData(vinfo.sm, matcher);
View Full Code Here


      return new String(cc, 0, count);
    }

    boolean match(String header, Message m) {
      Matcher matcher = pattern.matcher(header);
      if (!matcher.matches()) return false;

      if (first == null) {
        first = m;
      } else if (m.hashCode() != first.hashCode()) {
          System.out.println(" DDS doesnt match pqact= " + pats);
View Full Code Here

    return count;
  */

  String norm(String s) {
    Matcher matcher = pattern.matcher(s);
    if (!matcher.matches()) return s;
    return matcher.group(1);
  }

  Map<Integer, List<String>> problems = new TreeMap<Integer, List<String>>();

View Full Code Here

  private static final Pattern wmoPattern = Pattern.compile(".*([IJ]..... ....) .*");

  static String extractWMO(String header) {
    Matcher matcher = wmoPattern.matcher( header);
    if (!matcher.matches()) {
      //out.format("***header failed= %s\n", header);
      return null;
    }
    return matcher.group(1);
  }
View Full Code Here

    RandomAccessFile raf = new RandomAccessFile(filein, "r");
    MessageScanner scan = new MessageScanner(raf);
    while (scan.hasNext()) {
      Message m = scan.next();
      Matcher matcher = p.matcher(m.getHeader());
      if (matcher.matches()) {
        scan.writeCurrentMessage(wbc);
        System.out.println(" found match "+m.getHeader());
      }
    }
    raf.close();
View Full Code Here

      while (true) {
        line = timeSeriesRaf.readLine();
        if (line == null) return null// only on EOF
        if (line.trim().length() == 0) continue;
        matcher = seriesVinfo.p.matcher(line);
        if (matcher.matches())
          break;
        System.out.printf("FAIL TimeSeriesIter <%s>%n", line);
      }
      countRead++;
      return new TimeSeriesData(matcher);
View Full Code Here

        @Override
        public StructureData next() throws IOException {
          if (!hasNext()) return null;
          Matcher matcher = profileVinfo.p.matcher(lines.get(countRead));
          StructureData sd;
          if (matcher.matches())
            sd = new StructureDataRegexp(profileVinfo.sm, matcher);
          else
            throw new IllegalStateException("line = "+lines.get(countRead)+ "pattern = "+profileVinfo.p );
          countRead++;
          return sd;
View Full Code Here

  public static final String getServerLocation(String repositoryLocation) {
    // Try to parse the server URL from the repository URL
    Pattern urlPattern = Pattern.compile("(.*)/" + Protocol.REPOSITORIES + "/[^/]*/?");
    Matcher matcher = urlPattern.matcher(repositoryLocation);

    if (matcher.matches() && matcher.groupCount() == 1) {
      return matcher.group(1);
    }
    else {
      return null;
    }
View Full Code Here

      line = raf.readLine();
      if (line == null) break;
      if (line.startsWith("#")) continue;
      if (line.trim().length() == 0) continue;
      Matcher matcher = p.matcher(line);
      return matcher.matches();
    }
    return false;
  }

  @Override
View Full Code Here

      long stnPos = stnInfo.rafile.getFilePointer();
      String line = stnInfo.rafile.readLine();
      if (line == null) break;

      Matcher matcher = stnInfo.p.matcher(line);
      if (!matcher.matches()) {
        System.out.printf("FAIL %s%n", line);
        continue;
      }
      String svalue = matcher.group(f.fldno);
      Long id = Long.parseLong(svalue.trim());
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.