invalid group reference

Create issue
Issue #186 invalid
Former user created an issue

regex.sub(r"(?>\d*.\d\d\d?)\d+", r"\1", "5.6250006")

invalid group reference

regex.sub(r"(\d*.\d\d\d?+)\d+", r"\1", "5.6250006") '5.625' work

regex.sub(r"(?>\d*.\d\d\d?)\d+", r"\1", "5.625") work

Comments (1)

  1. Matthew Barnett repo owner
    1. regex.sub(r"(?>\d*.\d\d\d?)\d+", r"\1", "5.6250006")

      invalid group reference

    Finds a match, tries to use the replacement template, but there's no capture group.

    1. regex.sub(r"(\d*.\d\d\d?+)\d+", r"\1", "5.6250006") '5.625' work

    Finds a match, uses the replacement template.

    1. regex.sub(r"(?>\d*.\d\d\d?)\d+", r"\1", "5.625") work

    Doesn't match, doesn't use the replacement template.

  2. Log in to comment