[正则表达式] 大小写字母和数字的字符匹配的实例

来源:互联网 发布:免费建造师做题软件 编辑:程序博客网 时间:2024/05/29 02:29
/**  * This method will verify the text of the current element is the random code or not.  *   * @param elementName  *            The name of the current element.  *   * @param expectSize  *            The location of random code.  *   */ public boolean verifyIsRandomCode(String elementName, String expectSize) {  boolean flag = false;  String elementLocator = uiMapElementLocator("", "", elementName);  String randomCode = ui.getText(elementLocator);  Pattern pattern = Pattern.compile("[A-Za-z0-9]*");  if(pattern.matcher(randomCode).matches() && (randomCode.length() == Integer.parseInt(expectSize))){   flag = true;  }    return flag; }


 

0 0
原创粉丝点击