I have a bunch of regex within PHP, with the first clause being:
if (preg_match('#^/index#i', $_SERVER['REQUEST_URI']) || preg_match('#^/(ACT)|(NSW)|(NT)|(QLD)|(SA)|(TAS)|(VIC)|(WA)/$#i', $_SERVER['REQUEST_URI'])){
Now, say $_SERVER['REQUEST_URI'] is equal to /VIC/events/; this is for some reason matched by this first clause. Why? Shouldn’t that only match it if it was equal to /VIC/ as I added the end of line character $?
You need parentheses around your alternation:
Without the parentheses
^a|b|c$means(^a)|b|(c$)which is not what you intended.