Examples of replaceFirst()


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

    public static String maskURLPassword(String url) {
        final Matcher urlMatcher = URL_PATTERN.matcher(url);
        String maskUrl;
        if (urlMatcher.find()) {
            final Matcher pwdMatcher = PASSWORD_PATTERN.matcher(url);
            maskUrl = pwdMatcher.replaceFirst("\":***@\"");
            return maskUrl;
        }
        return url;
    }

View Full Code Here

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

      String jdbcUrl = toReturn.getProperty("cache.jdbc.url");
      Pattern pattern = Pattern.compile("jbosscache");
      Matcher matcher = pattern.matcher(jdbcUrl);
      boolean found = matcher.find();
      assert found;
      String newJdbcUrl = matcher.replaceFirst(extractTestName() + userIndex.incrementAndGet());
      toReturn.put("cache.jdbc.url", newJdbcUrl);
      return toReturn;
   }

   private static String extractTestName()
View Full Code Here

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

        {
          result = log_matcher.replaceAll(detect_matcher.group(2));
        }
        else
        {
          result = log_matcher.replaceFirst(detect_matcher.group(2));
        }

        if (!last_log.equals(result))
        {
          if (result.length() > 120)
View Full Code Here

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

    Calendar calendar = new GregorianCalendar(timeZone);
   
    //Find if there is any time information in the date
    Matcher matcher = getTimeComponent.matcher(s);
    //Remove the time information in order to not confuse the date parsing
    s = matcher.replaceFirst("").trim();
   
      // handle date with format "2009-01-12 at 03:36:38" by removing trailing " at";
   
    if ( s.endsWith( " at" )){
     
View Full Code Here

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

            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

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

    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

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

        //  $rep_type = $1 if( s#^(METAR|SPECI|TESTM|TESTS) ## ) ;
        m = MP.B_metar.matcher(report);
        if (m.find()) {
            field.put("Report_Type", m.group(1));
            report = m.replaceFirst("");
        } else { // default
            field.put("Report_Type", "METAR");
        }
        unit.put("Report_Type", "" );
View Full Code Here

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

        //  $stn_name = $1 if( s#^(\w4) ## ) ;
        m = MP.station.matcher(report);
        if (m.find()) {
            field.put("Station", m.group(1));
            unit.put("Station", "" );
            report = m.replaceFirst(" ");
        } else {
            return false;
        }

        // all patterns from this point are embeded in spaces
View Full Code Here

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

            unit.put("Day", "" );
            field.put("Hour", m.group(2));
            unit.put("Hour", "" );
            field.put("Minute", m.group(3));
            unit.put("Minute", "" );
            report = m.replaceFirst(" ");
        } else {
            return false;
        }

        // skip NIL reports
View Full Code Here

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

            return false;
        }

        m = MP.COR.matcher(report);
        if (m.find()) {
            report = m.replaceFirst(" ");
        }

        //  $AUTO = 1 if( s#AUTO\s+## ) ;
        m = MP.AUTOS.matcher(report);
        if (m.find()) {
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.