public static Map < String , String > extractMetatags ( String html ) { Map < String , String > metatagsMap = new HashMap <> ( ) ; Matcher m = METATAG_PATTERN . matcher ( html ) ; while ( m . find ( ) ) { if ( m . groupCount ( ) == 2 ) { String name = m . group ( 1 ) ; String content = m . group ( 2 ) ; metatagsMap . put ( clear ( name ) , clear ( content ) ) ; } } return metatagsMap ; }
Extracts the meta tags from an HTML page and returns them in a map .