code: private void waitForAttributePatternMatcher(String attributeName, String pattern, long timeout, boolean waitCondition) throws WidgetException {
  		long start = System.currentTimeMillis();
  		long end = start + timeout;
  		while (System.currentTimeMillis() < end) {
  			String attribute = getAttribute(attributeName);
  			if (attribute != null && attribute.matches(pattern) == waitCondition)
  				return;
  			try {
  				Thread.sleep(DEFAULT_INTERVAL);
  			} catch (InterruptedException e) {
  				throw new RuntimeException(e);
  			}
  		}
  		throw new TimeOutException("waitForAttribute " + " : timeout : Locator : " + locator + " Attribute : " + attributeName);
  	}
docs: Matches an attribute value to a pattern that is passed.
  
  @param attributeName
  the attribute whose value os to be compared
  @param pattern
  the pattern to which to match
  @param timeout
  time in milliseconds after which request timeout occurs
  @param waitCondition
  true to match the attribute value and false to not match the
  value
  @throws WidgetException