code: public int getOffsetForPattern(IXtextDocument document, int startOffset, String pattern) {
  		final Pattern compiledPattern = Pattern.compile(pattern);
  		final Matcher matcher = compiledPattern.matcher(document.get());
  		if (matcher.find(startOffset)) {
  			final int end = matcher.end();
  			return end;
  		}
  		return -1;
  	}
docs: Replies the offset that corresponds to the given regular expression pattern.
  
  @param document the document to parse.
  @param startOffset the offset in the text at which the pattern must be recognized.
  @param pattern the regular expression pattern.
  @return the offset (greater or equal to the startOffset), or <code>-1</code> if the pattern
  cannot be recognized.