public Map < String , String > getValByRegex ( String regex ) { Pattern p = Pattern . compile ( regex ) ; Map < String , String > result = new HashMap < String , String > ( ) ; Matcher m ; for ( Map . Entry < Object , Object > item : getProps ( ) . entrySet ( ) ) { if ( item . getKey ( ) instanceof String && item . getValue ( ) instanceof String ) { m = p . matcher ( ( String ) item . getKey ( ) ) ; if ( m . find ( ) ) { // match result . put ( ( String ) item . getKey ( ) , ( String ) item . getValue ( ) ) ; } } } return result ; }
get keys matching the the regex .