Why does this regex match the pattern that ends with "foo"? debuggex.com/r/P1-z22SO7tJ9… - shouldn't the $ stop that?