Package java.util.regex

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


  static List<Rule> parseRules(String rules) {
    List<Rule> result = new ArrayList<Rule>();
    String remaining = rules.trim();
    while (remaining.length() > 0) {
      Matcher matcher = ruleParser.matcher(remaining);
      if (!matcher.lookingAt()) {
        throw new IllegalArgumentException("Invalid rule: " + remaining);
      }
      if (matcher.group(2) != null) {
        result.add(new Rule());
      } else {
View Full Code Here


        }
        String path = initial.getPath();
        // Match /../[../] etc.
        Pattern p = Pattern.compile("^/((?:\\.\\./)+)"); // $NON-NLS-1$
        Matcher m = p.matcher(path);
        if (m.lookingAt()){
            String prefix = m.group(1); // get ../ or ../../ etc.
            if (location.startsWith(prefix)){
                return new URL(baseURL, location.substring(prefix.length()));
            }
        }
View Full Code Here

    Metadata subset = new Metadata();

    for (Object key : m.getHashtable().keySet()) {

      Matcher matcher = pattern.matcher((String) key);
      if (matcher.lookingAt()) {
        subset.addMetadata((String) key, m.getMetadata((String) key));
      }
    }

    return subset;
View Full Code Here

    }

    private String parseEnhancedStatusCode(String message)
            throws ParseException {
        Matcher matcher = pattern.matcher(message);
        if (!matcher.lookingAt())
            throw new ParseException("Not a valid enhanced status code", 0);
        return matcher.group(1);
    }

    private String removeStatusCodesFromMessage(String statusCode,
View Full Code Here

                        formattedString);

                if ((getMatchingMode() == MODE_EQUALS) && matcher.matches()) {
                    result = matcher.end();
                } else if ((getMatchingMode() == MODE_STARTS_WITH)
                        && matcher.lookingAt()) {
                    result = matcher.end();
                }
            }
        } catch (StackOverflowError soe) {
            getLogger().warning(
View Full Code Here

        if (formattedString != null) {
            try {
                Matcher matcher = getRegexPattern().matcher(formattedString);
                boolean matched = ((getMatchingMode() == MODE_EQUALS) && matcher
                        .matches())
                        || ((getMatchingMode() == MODE_STARTS_WITH) && matcher
                                .lookingAt());

                if (matched) {
                    // Update the number of matched characters
                    result = matcher.end();
View Full Code Here

        nameCache = new HashMap();
        for (int i = 0; i < files.length; i++) {
            name = files[i].getName();
            m = NAME.matcher(name);
            if (m.lookingAt() && files[i].isFile()) {
                nameCache.put(m.group().toUpperCase(), files[i]);
            }
        }
    }
View Full Code Here

                    break;
                }
                str = str.trim();
                if (!str.equals("") && !str.startsWith("--")) {
                    m = NAME.matcher(str);
                    return m.lookingAt() ? m.group() : null;
                }
            }
        } catch (FileNotFoundException ignore) {
            // Do nothing
        } catch (IOException ignore) {
View Full Code Here

      Color color = Color.black;
      String fontAndColor = msg.getHeaderField("X-MMS-IM-Format");
      if(fontAndColor != null)
      {
        Matcher m = xMmsImFormatPattern.matcher(fontAndColor);
        if(m.lookingAt())
        {
          String fontName = m.group(1);
          String effects = m.group(2);
          String bgr = m.group(3);
          if(fontName != null && !fontName.trim().equals(""))
View Full Code Here

     * warn-date  = <"> HTTP-date <">
     */
    protected void consumeWarnDate() {
        final int curr = offs;
        final Matcher m = WARN_DATE_PATTERN.matcher(src.substring(offs));
        if (!m.lookingAt()) {
            parseError();
        }
        offs += m.end();
        try {
            warnDate = DateUtils.parseDate(src.substring(curr+1,offs-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.