Pattern pattern = Pattern.compile("^王$", Pattern.CASE_INSENSITIVE);
2右匹配
Pattern pattern = Pattern.compile("^.*王$", Pattern.CASE_INSENSITIVE);
3左匹配
Pattern pattern = Pattern.compile("^王.*$", Pattern.CASE_INSENSITIVE);
4模糊匹配
Pattern pattern = Pattern.compile("^.*王.*$", Pattern.CASE_INSENSITIVE);
BasicDBObject query = new BasicDBObject();
query.put("account_name", new BasicDBObject("$regex", pattern));