WordPress add_permastruct unwanted matches

I’ve been struggling all morning to solve this and found your question when searching for the answer. I’m sure it’s a little late for you now but in case anyone else stumbles across this question here’s the solution I found:

Change:

$wp_rewrite->add_permastruct('competition', '/au/%prize_category%/%competition%/', false); 

To:

$wp_rewrite->add_permastruct( 'competition', '/au/%prize_category%/%competition%/', array( 'walk_dirs' => false ) );

walk_dirs rewrites the “directories” that make up the URL structure and is set to true by default. Setting it to false ensures the rewrite is only used for the full URL specified.