The answer is pretty simple. This is the modified my_init
function:
function my_init(){
add_rewrite_rule( '([^/]+)/(sub1|sub2|sub3|sub4)/?', 'index.php?pagename=$matches[1]&my_page=$matches[2]', 'top');
}
please note the pagename
variable which holds the name (slug) of the current page