Package java.util.regex

Examples of java.util.regex.Pattern.flags()


        Assert.assertEquals("encodes & decodes regex patterns",
                expected.pattern(),
                result.pattern());
        Assert.assertEquals("encodes & decodes regex flags",
                expected.flags(),
                result.flags());
    }
}
View Full Code Here


        public String toRegularExpression() {
          StringBuilder sb = new StringBuilder();
          sb.append('/');
          Escaping.normalizeRegex(p.pattern(), sb);
          sb.append('/');
          if ((p.flags() & Pattern.CASE_INSENSITIVE) != 0) { sb.append('i'); }
          return sb.toString();
        }

        public boolean accept(String candidate) {
          return p.matcher(candidate).find();
View Full Code Here

    ObjectId oid = (ObjectId)data.get("ObjectId");
    assertEquals(Integer.MAX_VALUE, oid.getTime());
    assertEquals(-2, oid.getMachine());
    assertEquals(Integer.MIN_VALUE, oid.getInc());
    Pattern p2 = (Pattern)data.get("Regex");
    assertEquals(p.flags(), p2.flags());
    assertEquals(p.pattern(), p2.pattern());
  }
 
  @Test
  public void parseUndefined() throws Exception {
View Full Code Here

    BSONObject obj = generateAndParse(data);

    Pattern result = (Pattern) obj.get("pattern");
    assertNotNull(result);
    assertEquals(pattern.pattern(), result.pattern());
    assertEquals(pattern.flags(), result.flags());
  }

  @Test
  public void timestamps() throws Exception {
    Timestamp timestamp = new Timestamp(100, 200);
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.