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 ; }
Replies the offset that corresponds to the given regular expression pattern .