public Tag getTagForPattern ( CharSequence text ) { for ( final Tag tag : Tag . values ( ) ) { Pattern pattern = this . compiledPatterns . get ( tag ) ; if ( pattern == null ) { pattern = Pattern . compile ( "^\\s*" + getPattern ( tag ) , Pattern . DOTALL ) ; //$NON-NLS-1$ this . compiledPatterns . put ( tag , pattern ) ; } final Matcher matcher = pattern . matcher ( text ) ; if ( matcher . find ( ) ) { return tag ; } } return null ; }
Replies the tag that is matching the given text .