private static String getTemplateMarker ( String str ) throws IllegalStateException { Pattern p = Pattern . compile ( "\\{\\{(.*?)\\}\\}" , Pattern . DOTALL ) ; Matcher matcher = p . matcher ( str ) ; String tpl = null ; while ( matcher . find ( ) ) { if ( tpl != null ) { throw new IllegalStateException ( "More than one template in the sentence." ) ; } tpl = matcher . group ( 1 ) ; } return tpl ; }
Returns the template marker of the sentence .