Function isStrictBackreference

  • Returns whether the given backreference is a strict backreference.

    Strict backreferences are backreferences that are always matched after the referenced group was matched. If there exists any path that goes through a backreference but not through the referenced capturing group, that backreference is not strict.

    Examples

    In the follow examples, \1 is a strict backreference:

    • /(a)\1/
    • /(a)(?:b|\1)/
    • /(a)\1?/
    • /(?<=\1(a))b/

    In the follow examples, \1 is not a strict backreference:

    • /(a)|\1/
    • /(?:(a)|b)\1/
    • /(a)?\1/
    • /(?<=(a)\1)b/
    • /(?!(a)).\1/

    Parameters

    • backreference: Backreference

    Returns boolean