Examples of lookingAt()


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

  public void test (TestHarness harness)
  {
    String s = "food bar fool";
    Matcher m = Pattern.compile("^foo.").matcher(s);
   
    harness.check(m.lookingAt(), "Match foo at start of " + s);
    harness.check(m.group(), "food");

    m.reset();
    m.region(9, s.length());
    harness.check(m.lookingAt(), "Match foo at start of " + s.substring(9));
View Full Code Here

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

    harness.check(m.lookingAt(), "Match foo at start of " + s);
    harness.check(m.group(), "food");

    m.reset();
    m.region(9, s.length());
    harness.check(m.lookingAt(), "Match foo at start of " + s.substring(9));
    harness.check(m.group(), "fool");

    m.reset();
    m.region(9, 10);
    harness.check(m.lookingAt(), false,
View Full Code Here

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

    harness.check(m.lookingAt(), "Match foo at start of " + s.substring(9));
    harness.check(m.group(), "fool");

    m.reset();
    m.region(9, 10);
    harness.check(m.lookingAt(), false,
      "Match foo at start of " + s.substring(9,10));
   
  }
}
View Full Code Here

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

    public void setAsText(String s) {

        if (supportsCustomColorMode() && colorizerFactory.matchCustomColorMode(s)) {
            Pattern p = Pattern.compile("\\w+\\s*\\[\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\]");
            Matcher m = p.matcher(s);
            if (m.lookingAt()) {
                int r = Integer.valueOf(m.group(1));
                int g = Integer.valueOf(m.group(2));
                int b = Integer.valueOf(m.group(3));

                setValue(colorizerFactory.createCustomColorMode(r, g, b));
View Full Code Here

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

     */
    private boolean matchColorMode(String s, String identifier) {
        String regexp = String.format("\\s*%s\\s*", identifier);
        Pattern p = Pattern.compile(regexp);
        Matcher m = p.matcher(s);
        return m.lookingAt();
    }

    /**
     * Returns whether or not the given string matches with the
     * CustomColorMode's identifier.
View Full Code Here

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

        }
        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

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

    public JLinkLabel(String label) {
        setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

        while (label.length() > 0) {
            Matcher m = LINK_PAT.matcher(label);
            if (m.lookingAt()) {
                String preText = m.group(1);
                String attrs = m.group(2);
                String linkText = m.group(3);

                if (preText.length() > 0)
View Full Code Here

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

  public Number parse(String source, ParsePosition parsePosition) {
    int pos = parsePosition.getIndex();
    source = source.substring(pos);

    Matcher m = HOUR_MINUTE_PATTERN.matcher(source);
    if (m.lookingAt() && (m.group(2) != null || m.group(3) != null)) {
      parsePosition.setIndex(pos + m.end());
      long result = 0;
      if (m.group(2) != null)
        result += 60 * Long.parseLong(m.group(2));
      if (m.group(3) != null)
View Full Code Here

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

        result = -1 * result;
      return new Long(result);
    }
   
    m = MINUTE_ONLY_PATTERN.matcher(source);
    if (m.lookingAt()) {
      parsePosition.setIndex(pos + m.end());
      long result = Long.parseLong(m.group(2));
      if (m.group(1) != null)
        result = -1 * result;
      return new Long(result);
View Full Code Here

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

        if (pos < 1)
            return null;

        // find the "as" clause that follows the entity name.
        Matcher m = AS_CLAUSE_PAT.matcher(query).region(pos, query.length());
        if (!m.lookingAt())
            throw new IllegalArgumentException(
                    "HQL autofiltering logic requires the '" + entityName
                            + "' entity to be followed by an 'as' clause.");
        String alias = m.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.