Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\1 in key_value used in group name path_string #98

Open
myxx921 opened this issue Feb 7, 2023 · 0 comments
Open

\1 in key_value used in group name path_string #98

myxx921 opened this issue Feb 7, 2023 · 0 comments

Comments

@myxx921
Copy link

myxx921 commented Feb 7, 2023

hi, if key_value contains \1, \2 , \3 , etc.
and this key_value is used to compose get error

from ttp import ttp
from pprint import pprint

data = r"""
routing-instances {
    "some_routing_instance_70\1" {
        instance-type vrf;
    }
}
"""

template = """
<group name="interfaces.{{ ri }}**">
routing-instances {{ ignore }} 
    {{ ri | _start_ }} { 
    } {{ _end_ }}
</group>
"""

parser = ttp(data, template)
parser.parse()
output = parser.result()
pprint(output)

---------------------------------error-------------------------------------------------------

I changed the output to see what we got as input

raise s.error(f"{source} {state} {type(state)} invalid group reference %d" % index, pos)
re.error: "some_routing_instance_70\1" re.compile('{{\sri\s}}') <class 're.Pattern'> invalid group reference 1 at position 26

dmulyalin added a commit that referenced this issue Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant