Package java.util.regex

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


      long dataPos = dataInfo.rafile.getFilePointer();
      String line = dataInfo.rafile.readLine();
      if (line == null) break;

      Matcher matcher = dataInfo.p.matcher(line);
      if (!matcher.matches()) {
        System.out.printf("FAIL %s%n", line);
        continue;
      }

      String svalue = matcher.group(f.fldno).trim();
View Full Code Here


        String line = vinfo.rafile.readLine();
        if (line == null) return null;
        if (line.startsWith("#")) continue;
        if (line.trim().length() == 0) continue;
        matcher = vinfo.p.matcher(line);
        if (matcher.matches())
          break;
        System.out.printf("FAIL %s%n", line);
      }
      //System.out.printf("%s%n", line);
      bytesRead = vinfo.rafile.getFilePointer();
View Full Code Here

        line = dataRaf.readLine();
        if (line == null) return null;
        if (line.startsWith("#")) continue;
        if (line.trim().length() == 0) continue;
        matcher = dataPattern.matcher(line);
        if (matcher.matches())
          break;
      }
      //System.out.printf("%s%n", line);
      countRead++;
      return new StructureDataRegexp(sm, matcher);
View Full Code Here

  ////////////////////////////////////

  static private int parseLine(String line) throws IOException {
    int balony = 0;
    Matcher matcher = dataPattern.matcher(line);
    if (matcher.matches()) {
      for (int i=1; i<=matcher.groupCount(); i++) {
        String r = matcher.group(i);
        if (r == null) continue;
        int value = (int) Long.parseLong(r.trim());
        balony += value;
View Full Code Here

            if ( !keys.isEmpty()) {
                for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
                    String  key = (String) iter.next();
                    Pattern p   = Pattern.compile(key);
                    Matcher m   = p.matcher(name);
                    if (m.matches()) {
                        //System.out.println("found match " + key + " for " + name);
                        String value = m.group(1);
                        GempakParameter match =
                            (GempakParameter) templateParamMap.get(key);
                        param = new GempakParameter(match.getNumber(), name,
View Full Code Here

  @Override
  public boolean matches(String url) {
    Matcher matcher = mUrlRegex.matcher(url);
    mLog.debug("Matches with pattern: " + mUrlRegexAsString + ", " + mUrlRegex.pattern());
   
    return matcher.matches();
  }


  /**
   * Gets a String representation of this UrlMatcher.
View Full Code Here

    List<String> fnames = new ArrayList<String>();
    for(MachineTag mt : machineTags){
      String mtStr = mt.toString();
      Matcher matcher = altSyntaxPattern.matcher(mtStr);
      String folderName = null;
      if(matcher.matches()){
        String tag = matcher.group(1);
        if(isSystemFolder(tag) == false){
          folderName = TagUtil.mapUnderscoreToSpace(tag);
        }else{
          folderName = tag;
View Full Code Here

        }else{
          folderName = tag;
        }
      }else{
        matcher = fullSyntaxPattern.matcher(mtStr);
        if(matcher.matches()){         
          String tag = matcher.group(1);
          if(isSystemFolder(tag) == false){
            folderName = TagUtil.mapUnderscoreToSpace(tag);
          }else{
            folderName = tag;
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;
    }catch(Exception e){
View Full Code Here

  private List<String> getForUsers(List<MachineTag> machineTags){
    List<String> users = new ArrayList<String>();
    for(MachineTag mt : machineTags){
      String mtStr = mt.toString();
      Matcher matcher = altSyntaxPattern.matcher(mtStr);
      if(matcher.matches()){
        users.add(matcher.group(1));
      }else{
        matcher = fullSyntaxPattern.matcher(mtStr);
        if(matcher.matches()){
          users.add(matcher.group(1));
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.