Package java.util.regex

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


    }
  }

  private String consume(Pattern p, StringBuilder input) throws TemplateParserException {
    Matcher m = p.matcher(input);
    if (m.lookingAt()) {
      String string_to_return = m.group(1);
      // This is apparently an inefficient operation, but parsing should only
      // happen when the template is loaded or changes, so it doesn't happen
      // very often.
      input.delete(0, m.end());
View Full Code Here


    } else {
      pattern = pattern.trim().replaceAll("\\\\", "/");
      Pattern p = Pattern.compile("\\A(([a-zA-Z]:)?/)");
      Matcher matcher = p.matcher(pattern);
      // Look if we've got a absolute or a relativ path
      boolean startsWithSysRoot = matcher.lookingAt();
      if (startsWithSysRoot) {
        sections.add(new Section(pattern
            .substring(0, matcher.end() - 1)));
        pattern = pattern.substring(matcher.end());
      } else {
View Full Code Here

    CharSequence s = getUnparsedText();
   
    for (ParsePattern pattern: tokenPatterns) {
        Matcher m = pattern.getPattern().matcher(s);
        //System.out.println(s);
        if (m.lookingAt()) {
          int p = position; // TODO p wegrefactorn
          String match = m.group(); // korrekt?
          if (pattern.isIgnoreLastGroup()) {
            assert m.groupCount() > 0;
            String g = m.group(m.groupCount());
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

            BufferedReader fileHandle=new BufferedReader(script.getContent(request));
            try {
                String line;
                while ((line = fileHandle.readLine()) != null) {
                    Matcher m = ClosureDepsParser.reqRegex.matcher(line);
                    if (m.lookingAt()) {
                        String require = m.group(1);
                        resolveDependencies(require, searchHash, resultList, seenList);
                    }
                }
            } finally {
View Full Code Here

  public void searchDependencies(BufferedReader in, DependencyInfo dep) throws IOException {
    String line;
    while ((line = in.readLine()) != null) {
      if (line.indexOf("goog.require") != -1) {
        Matcher m = reqRegex.matcher(line);
        if (m.lookingAt())
          dep.getRequires().add(m.group(1));
      }
      if (line.indexOf("goog.provide") != -1) {
        Matcher m = provRegex.matcher(line);
        if (m.lookingAt())
View Full Code Here

        if (m.lookingAt())
          dep.getRequires().add(m.group(1));
      }
      if (line.indexOf("goog.provide") != -1) {
        Matcher m = provRegex.matcher(line);
        if (m.lookingAt())
          dep.getProvides().add(m.group(1));
      }
    }
  }
}
View Full Code Here

  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

  public String getAttributeNumberValue() {
    String string = "0";
    if (orderLineAttributeValue != null) {
      Pattern pattern = Pattern.compile("\\d*\\.?\\d*");
      Matcher matcher = pattern.matcher(orderLineAttributeValue);
      if (matcher.lookingAt()) {
        string = matcher.group();
      }

    }
    return string.length() != 0 ? string : "0";
View Full Code Here

   * @param args
   */
  public static void main(final String[] args) {
    Pattern pattern = Pattern.compile("\\d*\\.\\d*");
    Matcher matcher = pattern.matcher("22.5�");
    if (matcher.lookingAt()) {
      String string = matcher.group();
      System.out.println(string);
    }
    // Calculator.calculate("(0.5*Bredde+45)*tan(Vinkel)", null);
    Calculator.calculate("tan((38*pi/180))", null);
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.