finished regex based method