Fix spanning_regex to_code method