Package java.util.regex

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


        if (m.find()) {
            //field.put("CIGNO", "");
            //unit.put("CIGNO", "");
            field.put("Ceiling_height_available", "No");
            unit.put("Ceiling_height_available", "");           
            remark = m.replaceFirst(" ");
        }

        //  if( s#CIG(E)?(\d3)\s+## )
        //    if( $1 eq "E" )
        //      $Ceiling_est = $2 * 100 ;
View Full Code Here


                //unit.put("Ceiling_Estimate", "feet");
            //else {
                field.put("Ceiling", est);
                unit.put("Ceiling", "feet");
            //
            remark = m.replaceFirst(" ");
        }

        //   Variable Sky conditions
        //  if( s#(FEW|SCT|BKN|OVC)(\d3)? V (FEW|SCT|BKN|OVC)\s+## )
        //    $VrbSkyBelow = $1 ;
View Full Code Here

                field.put("Variable_Sky_Height", Integer.toString(Integer.parseInt(m.group(2)) * 100));
                unit.put("Variable_Sky_Height", "feet");
            }
            field.put("Variable_Sky_Above", m.group(3));
            unit.put("Variable_Sky_Above", "feet");
            remark = m.replaceFirst(" ");
        }

/* let these end up in extra_remarks

//   Significant Cloud Types
View Full Code Here

        //  $ACFTMSHP = 1 if( s#\(?ACFT\s?MSHP\)?\s+## ) ;
        m = MP.ACFT.matcher(remark);
        if (m.find()) {
            field.put("Air_craft_mishap", "yes");
            unit.put("Air_craft_mishap", "");
            remark = m.replaceFirst(" ");
        }

        //   No changes in weather conditions until next report  NOSPECI
        //  $NOSPECI = 1 if( s#NOSPECI\s+## ) ;
        m = MP.NOSPECI.matcher(remark);
View Full Code Here

        //  $NOSPECI = 1 if( s#NOSPECI\s+## ) ;
        m = MP.NOSPECI.matcher(remark);
        if (m.find()) {
            field.put("Changes_in_weather", "No");
            unit.put("Changes_in_weather", "");
            remark = m.replaceFirst(" ");
        }

        //   This is first report of the day  FIRST
        //  $FIRST = 1 if( s#FIRST\s+## ) ;
        m = MP.FIRST.matcher(remark);
View Full Code Here

    String out = xmlOutput.toString();
    if (!qEntities) return out;
    Matcher matcher = SearchTools.qwordPattern.matcher(out);
    if (matcher.matches())
    { out = matcher.replaceFirst(matcher.group(1) + "<Qword>" + matcher.group(2) + "</Qword>" + matcher.group(3) ); }
    return(out);
   }

   /**
    * Build the list of tokens, white spaces, and sentence boundaries for the paragraph passed
View Full Code Here

      String s = input.toLowerCase();

      Matcher matcher = UF_PATTERN.matcher(s);

      if (matcher.find()) {
        return matcher.replaceFirst(matcher.group(0).toUpperCase());
      } else {
        return input;
      }
    }
    case UPPER_EACH_FIRST: {
View Full Code Here

    if (pattern == null) {
      pattern = Pattern.compile(source);
    }
    Matcher matcher = pattern.matcher(input);
    if (matcher.matches()) {
      return matcher.replaceFirst(target);
    } else {
      return input;
    }
  }
View Full Code Here

                    Matcher pm = VOLNOPP_PATTERN.matcher(fstr);
                    if (pm.find()) {
                        hm.put("volume", pm.group(1));
                        hm.put("number", pm.group(2));
                        hm.put("pages", pm.group(3));
                        fstr = pm.replaceFirst("");
                    }

                    // pages
                    pm = PAGES_PATTERN.matcher(fstr);
                    StringBuffer pages = new StringBuffer();
View Full Code Here

                        if (pp == null)
                            pp = pm.group(2);
                        if (pp == null)
                            pp = pm.group(3);
                        pages.append(pp);
                        fstr = pm.replaceFirst("");
                        pm = PAGES_PATTERN.matcher(fstr);
                    }
                    if (pages.length() > 0)
                        hm.put("pages", pages.toString());
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.