{
  "id": "task_libraries:regex/python",
  "path": "/exapedia/python-regex-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python regular-expression libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python regex libraries match text against regular expression patterns with features beyond the standard library's re module. Some libraries bind a separate engine such as Hyperscan or Oniguruma rather than extending the re module. These libraries let search tools, log scanners, and AI agents match patterns against large volumes of text."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python regular-expression libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#regex",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F123"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F124"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F6"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F127"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F125"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#google-retwo",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F138"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F139"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F142"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F140"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#hyperscan",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F155"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F157"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyre",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F172"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F31"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F176"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F174"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#onigurumacffi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F187"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F189"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyperscan",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F204"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F205"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F51"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F208"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F206"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pcretwo",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F219"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F223"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#retwo",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F232"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F233"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F236"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F234"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "pypi"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#regex",
          "label": [
            {
              "t": "text",
              "text": "regex"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F124"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Streaming scan state",
            "Replacement API",
            "Multi-pattern database"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#regex",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F123"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F132"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#google-retwo",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F138"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#hyperscan",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F155"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyre",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F172"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#onigurumacffi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F187"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F196"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F197"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F198"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pyperscan",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F204"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F212"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F213"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pcretwo",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F219"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F228"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#retwo",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F232"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F241"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F242"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F243"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "regex",
          "name": [
            {
              "t": "fact",
              "fact": "F123"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/mrabarnett/mrab-regex"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/regex"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/pypi/regex/2026.11.15/json"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F11"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F124"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F6"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F126"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F125"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/regex/2026.11.15/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F123"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F12"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F137"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/nltk/nltk",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F136"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def compile(pattern, flags=0, timeout=_UNSET):\n    r\"\"\"Compile ``pattern`` with the :mod:`regex` engine and wrap it so every\n    match runs under a wall-clock timeout.\n\n    :param pattern: a regular-expression string, or an already-compiled\n        ``re``/``regex`` pattern (its ``.pattern`` is re-compiled with\n        ``regex``), or an existing :class:`TimedPattern` (returned as-is with\n        the requested timeout).\n    :param flags: regex flags (stdlib ``re`` flag constants are accepted).\n    :param timeout: default wall-clock limit for matches on the returned\n        pattern; ``None`` disables it. Omit to use :data:`DEFAULT_TIMEOUT` at\n        match time (so a later change to that module attribute still applies).\n    :rtype: TimedPattern\n    \"\"\"\n    if isinstance(pattern, TimedPattern):\n        if timeout is _UNSET:\n            return pattern\n        return TimedPattern(pattern._rx, timeout)\n    # Accept a pre-compiled ``re``/``regex`` pattern by re-compiling its source.\n    src = getattr(pattern, \"pattern\", pattern)\n    check_pattern(src)\n    try:\n        compiled = regex.compile(src, flags)\n    except regex.error as exc:\n        # Normalise the engine's error to a re.error subclass so callers that\n        # catch re.error still work after moving off the stdlib module.\n        raise error(str(exc)) from exc\n    return TimedPattern(compiled, timeout)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/nltk/nltk/blob/0ed5528a28c40e8071fe54cf370fc3020a287496/nltk/redos.py#L283-L310",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F135"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20regex%20for%20regular%20expressions%20extraction%20pattern%20compilation%20timeouts%20and%20streaming%20signature%20scanning&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F123"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import regex\n\nprint(regex.search(r\"\\w+\", \"hello\").group())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/regex/2026.11.15/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.rst"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F128"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "google-retwo",
          "name": [
            {
              "t": "fact",
              "fact": "F138"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/google/re2"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/google-re2"
            },
            {
              "label": "Docs",
              "href": "https://github.com/google/re2/blob/2025-11-05/python/re2.py"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F145"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F139"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F141"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F140"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/google/re2/blob/2025-11-05/python/re2.py",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F138"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F153"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F154"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/zulip/zulip",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F153"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def filter_pattern_validator(value: str) -> \"re2._Regexp[str]\":\n    try:\n        # Do not write errors to stderr (this still raises exceptions)\n        options = re2.Options()\n        options.log_errors = False\n\n        regex = re2.compile(value, options=options)\n    except re2.error as e:\n        if len(e.args) >= 1:\n            if isinstance(e.args[0], str):  # nocoverage\n                raise ValidationError(_(\"Bad regular expression: {regex}\").format(regex=e.args[0]))\n            if isinstance(e.args[0], bytes):\n                raise ValidationError(\n                    _(\"Bad regular expression: {regex}\").format(regex=e.args[0].decode())\n                )\n        raise ValidationError(_(\"Unknown regular expression error\"))  # nocoverage\n\n    return regex",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/zulip/zulip/blob/d770d79da7924cc7720fa8463d13d729ad6f3753/zerver/models/linkifiers.py#L64-L81",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F152"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=google-re2%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F138"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import re2\n\nprint(re2.search(r\"\\w+\", \"hello\").group())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/google/re2/blob/2025-11-05/python/re2.py",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F143"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "hyperscan",
          "name": [
            {
              "t": "fact",
              "fact": "F155"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/darvid/python-hyperscan"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/hyperscan"
            },
            {
              "label": "Docs",
              "href": "https://python-hyperscan.readthedocs.io/en/latest/usage/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F162"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F158"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F157"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://python-hyperscan.readthedocs.io/en/latest/usage/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F155"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F170"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F171"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/funstory-ai/BabelDOC",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F170"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _build_regex_and_lookup(self):\n    logger.debug(\n        f\"start build regex for glossary {self.name} with {len(self.entries)} entries\"\n    )\n    \"\"\"\n    Builds a combined regex for all source terms and a lookup dictionary\n    from normalized source terms to (original_source, original_target).\n    Regex patterns are sorted by length in descending order to prioritize longer matches.\n    \"\"\"\n    self.normalized_lookup = {}\n\n    if not self.entries:\n        self.source_terms_regex = None\n        return\n\n    self.hs_dbs = []\n    hs_pattern = []\n    start = time.time()\n    for idx, entry in enumerate(self.entries):\n        normalized_key = self.normalize_source(entry.source)\n        self.normalized_lookup[normalized_key] = (entry.source, entry.target)\n        self.id_lookup.append((entry.source, entry.target))\n\n        hs_pattern.append((re.escape(entry.source).encode(\"utf-8\"), idx))\n\n    chunk_size = 20000\n    for i, pattern_chunk in enumerate(\n        batched(hs_pattern, chunk_size, strict=False)\n    ):\n        logger.debug(\n            f\"building hs_db chunk {i + 1} / {len(self.entries) // chunk_size + 1}\"\n        )\n        expressions, ids = zip(*pattern_chunk, strict=False)\n\n        hs_db = hyperscan.Database()\n        hs_db.compile(\n            expressions=expressions,\n            ids=ids,\n            elements=len(pattern_chunk),\n            flags=hyperscan.HS_FLAG_CASELESS | hyperscan.HS_FLAG_SINGLEMATCH,\n            # | hyperscan.HS_FLAG_UTF8\n            # | hyperscan.HS_FLAG_UCP,\n        )\n        self.hs_dbs.append(hs_db)\n\n    end = time.time()\n    logger.debug(\n        f\"finished building regex for glossary {self.name} in {end - start:.2f} seconds\"\n    )\n    logger.debug(\n        f\"build hs database for glossary {self.name} with {len(self.entries)} entries, hs_info: {self.hs_dbs[0].info()}\"\n    )\n    if not self.hs_dbs:\n        self.hs_dbs = None",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/funstory-ai/BabelDOC/blob/dd9adc352b957533d05b8cb94e88a7589cc56a35/babeldoc/glossary.py#L97-L150",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F169"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=hyperscan%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F155"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import hyperscan\n\ndb = hyperscan.Database()\ndb.compile(expressions=[b\"foo\"], ids=[0])\ndb.scan(b\"foobar\", match_event_handler=lambda *event: print(event))\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://python-hyperscan.readthedocs.io/en/latest/usage/",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F160"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pyre",
          "name": [
            {
              "t": "fact",
              "fact": "F172"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/andreasvc/pyre2"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/pyre2"
            },
            {
              "label": "Docs",
              "href": "https://api.github.com/repos/andreasvc/pyre2/git/blobs/db88a57fd4e0beb82483f6c0af2ba68803612de4"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F36"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F31"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F175"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F174"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/andreasvc/pyre2/git/blobs/db88a57fd4e0beb82483f6c0af2ba68803612de4",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F172"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F37"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F38"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F185"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F186"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/simple-login/app",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F185"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def regex_match(rule_regex: str, local):\n    regex = re2.compile(rule_regex)\n    try:\n        if re2.fullmatch(regex, local):\n            return True\n    except TypeError:  # re2 bug \"Argument 'pattern' has incorrect type (expected bytes, got PythonRePattern)\"\n        LOG.w(\"use re instead of re2 for %s %s\", rule_regex, local)\n        regex = re.compile(rule_regex)\n        if re.fullmatch(regex, local):\n            return True\n    return False",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/simple-login/app/blob/4d5d8c18f7cdbc257e01c9f4cc2c929c5acbf839/app/regex_utils.py#L8-L18",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F184"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pyre2%20for%20regular%20expressions%20extraction%20pattern%20compilation%20timeouts%20and%20streaming%20signature%20scanning&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F172"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import re2\n\nprint(re2.search(r\"\\w+\", \"hello\").group())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/andreasvc/pyre2/git/blobs/db88a57fd4e0beb82483f6c0af2ba68803612de4",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.rst"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F177"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "onigurumacffi",
          "name": [
            {
              "t": "fact",
              "fact": "F187"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/asottile/onigurumacffi"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/onigurumacffi"
            },
            {
              "label": "Docs",
              "href": "https://api.github.com/repos/asottile/onigurumacffi/readme"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F194"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F189"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/asottile/onigurumacffi/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F187"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F203"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/asottile/babi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F202"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def search(\n        self,\n        line: str,\n        pos: int,\n        first_line: bool,\n        boundary: bool,\n) -> Match[str] | None:\n    return self._reg.search(line, pos, flags=_FLAGS[first_line, boundary])",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/asottile/babi/blob/2cb63abc6b1ebcfddab3bcedd9aef9893d5f624d/babi/reg.py#L39-L46",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F201"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=onigurumacffi%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F187"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import onigurumacffi\n\npattern = onigurumacffi.compile(r\"\\w+\")\nprint(pattern.search(\"hello\").group())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/asottile/onigurumacffi/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F192"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pyperscan",
          "name": [
            {
              "t": "fact",
              "fact": "F204"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/vlaci/pyperscan"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/pyperscan"
            },
            {
              "label": "Docs",
              "href": "https://vlaci.github.io/pyperscan/usage/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F54"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F205"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F51"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F207"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F206"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://vlaci.github.io/pyperscan/usage/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F204"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F55"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F56"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F57"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F58"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F59"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F60"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F217"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F218"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/onekey-sec/unblob",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F217"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "@lru_cache\ndef build_hyperscan_database(handlers: Handlers) -> StreamDatabase:\n    patterns = []\n    for handler_class in handlers:\n        handler = handler_class()\n        for pattern in handler.PATTERNS:\n            try:\n                patterns.append(\n                    Pattern(\n                        pattern.as_regex(),\n                        Flag.SOM_LEFTMOST,\n                        Flag.DOTALL,\n                        tag=handler,\n                    )\n                )\n            except InvalidHexString as e:\n                logger.error(\n                    \"Invalid pattern\",\n                    handler=handler.NAME,\n                    pattern=pattern,\n                    error=str(e),\n                )\n                raise\n    return StreamDatabase(*patterns)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/onekey-sec/unblob/blob/d057b3a0435c61b91cc03bed1933499c14f06735/python/unblob/finder.py#L173-L196",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F216"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pyperscan%20for%20regular%20expressions%20extraction%20pattern%20compilation%20timeouts%20and%20streaming%20signature%20scanning&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F204"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pyperscan as ps\n\ndef on_match(context, tag, start, end):\n    context.append((tag, start, end))\n    return ps.Scan.Continue\n\nmatches = []\ndb = ps.BlockDatabase(ps.Pattern(b\"foo\", ps.Flag.SOM_LEFTMOST))\nscanner = db.build(matches, on_match)\nscanner.scan(b\"foobar\")\nprint(matches)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://vlaci.github.io/pyperscan/usage/",
                  "label": [
                    {
                      "t": "text",
                      "text": "usage.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F209"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pcretwo",
          "name": [
            {
              "t": "fact",
              "fact": "F219"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/grtetrault/pcre2.py"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/pcre2"
            },
            {
              "label": "Docs",
              "href": "https://api.github.com/repos/grtetrault/pcre2.py/readme"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F226"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F222"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/grtetrault/pcre2.py/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F219"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pcre2\n\npattern = pcre2.compile(r\"\\w+\")\nprint(pattern.search(\"hello\").group())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/grtetrault/pcre2.py/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=pcre2%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F219"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F224"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "retwo",
          "name": [
            {
              "t": "fact",
              "fact": "F232"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/axiak/pyre2"
            },
            {
              "label": "pypi",
              "href": "https://pypi.org/project/re2"
            },
            {
              "label": "Docs",
              "href": "https://api.github.com/repos/axiak/pyre2/readme"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F239"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F233"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F235"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F234"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/axiak/pyre2/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F232"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import re2\n\nprint(re2.search(r\"\\w+\", \"hello\").group())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/axiak/pyre2/readme",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.rst"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=re2%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F232"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F237"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python regex library should I use?",
      "a": [
        {
          "t": "text",
          "text": "The standard library's re module covers most patterns. "
        },
        {
          "t": "link",
          "href": "#regex",
          "label": [
            {
              "t": "text",
              "text": "regex"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits code that needs repeated capture history, full Unicode case-folding, or fuzzy matching. "
        },
        {
          "t": "link",
          "href": "#google-retwo",
          "label": [
            {
              "t": "fact",
              "fact": "F138"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits code that needs Google's regex engine. "
        },
        {
          "t": "link",
          "href": "#hyperscan",
          "label": [
            {
              "t": "text",
              "text": "hyperscan"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits scanning text against many patterns at once."
        }
      ]
    },
    {
      "q": "Which regular expression engine is bundled with Python?",
      "a": [
        {
          "t": "text",
          "text": "The re module supplies regular expression operations in Python's standard library. It ships with Python and needs no install."
        }
      ]
    },
    {
      "q": "Does a repeated re group return every captured value?",
      "a": [
        {
          "t": "text",
          "text": "No. The re module keeps only the last capture of a group that matches repeatedly. The "
        },
        {
          "t": "link",
          "href": "#regex",
          "label": [
            {
              "t": "text",
              "text": "regex"
            }
          ]
        },
        {
          "t": "text",
          "text": " module's captures method returns the full capture history for a named group."
        }
      ]
    },
    {
      "q": "Can re mix a bytes pattern with a Unicode string?",
      "a": [
        {
          "t": "text",
          "text": "No. The pattern, the input, and any replacement must share one type, either Unicode strings or bytes."
        }
      ]
    },
    {
      "q": "Does regex fuzzy matching choose the best match?",
      "a": [
        {
          "t": "text",
          "text": "Not by default. The BESTMATCH flag changes fuzzy matching from the next match to the best match."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, regex",
      "display": "regex",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, regex",
      "display": "378.2M",
      "asOf": "2026-11-17"
    },
    "F3": {
      "label": "License, regex",
      "display": "Apache-2.0 AND CNRI-Python",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, regex",
      "display": "2026.11.15, Nov 2026",
      "asOf": "2026-11-15"
    },
    "F5": {
      "label": "Package release date, regex",
      "display": "Nov 2026",
      "asOf": "2026-11-15"
    },
    "F6": {
      "label": "Repository stars, regex",
      "display": "609",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Lookarounds, regex",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Backreferences, regex",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Unicode properties, regex",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Install, regex",
      "display": "pip install regex",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "What it does, regex",
      "display": "Extends Python’s regular-expression interface with additional matching features.",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "strengths lead, regex",
      "display": "Retains repeated capture history",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths, regex",
      "display": "Use captures to retrieve every capture of a repeated named group.",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths lead, regex",
      "display": "Supports full Unicode case-folding",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths, regex",
      "display": "Enable FULLCASE with IGNORECASE for full Unicode case-insensitive matching.",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "limitations lead, regex",
      "display": "Fuzzy matching needs quality settings",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations, regex",
      "display": "Enable BESTMATCH when the best fuzzy result is required.",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations lead, regex",
      "display": "Concurrent matching needs unchanged input",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations, regex",
      "display": "Keep input unchanged when concurrent matching releases the GIL.",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "Quickstart, regex",
      "display": "import regex\n\nm = regex.match(r\"(?:(?P<word>\\w+) (?P<digits>\\d+)\\n)+\", \"one 1\\ntwo 2\\nthree 3\\n\")\nm.groupdict()\nm.captures(\"word\")\nm.captures(\"digits\")\nm.capturesdict()\n",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Project function, regex",
      "display": "def compile(pattern, flags=0, timeout=_UNSET):\n    r\"\"\"Compile ``pattern`` with the :mod:`regex` engine and wrap it so every\n    match runs under a wall-clock timeout.\n\n    :param pattern: a regular-expression string, or an already-compiled\n        ``re``/``regex`` pattern (its ``.pattern`` is re-compiled with\n        ``regex``), or an existing :class:`TimedPattern` (returned as-is with\n        the requested timeout).\n    :param flags: regex flags (stdlib ``re`` flag constants are accepted).\n    :param timeout: default wall-clock limit for matches on the returned\n        pattern; ``None`` disables it. Omit to use :data:`DEFAULT_TIMEOUT` at\n        match time (so a later change to that module attribute still applies).\n    :rtype: TimedPattern\n    \"\"\"\n    if isinstance(pattern, TimedPattern):\n        if timeout is _UNSET:\n            return pattern\n        return TimedPattern(pattern._rx, timeout)\n    # Accept a pre-compiled ``re``/``regex`` pattern by re-compiling its source.\n    src = getattr(pattern, \"pattern\", pattern)\n    check_pattern(src)\n    try:\n        compiled = regex.compile(src, flags)\n    except regex.error as exc:\n        # Normalise the engine's error to a re.error subclass so callers that\n        # catch re.error still work after moving off the stdlib module.\n        raise error(str(exc)) from exc\n    return TimedPattern(compiled, timeout)\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function reference, regex",
      "display": "redos.py · compile()",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project repository, regex",
      "display": "nltk/nltk",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project stars, nltk/nltk",
      "display": "14.8K",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project push date, nltk/nltk",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F26": {
      "label": "Library name, pyre2",
      "display": "pyre2",
      "asOf": "2026-11-17"
    },
    "F27": {
      "label": "Monthly downloads, pyre2",
      "display": "341.6K",
      "asOf": "2026-11-17"
    },
    "F28": {
      "label": "License, pyre2",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "Package release, pyre2",
      "display": "0.3.14, Sep 2026",
      "asOf": "2026-09-25"
    },
    "F30": {
      "label": "Package release date, pyre2",
      "display": "Sep 2026",
      "asOf": "2026-09-25"
    },
    "F31": {
      "label": "Repository stars, pyre2",
      "display": "109",
      "asOf": "2026-11-17"
    },
    "F32": {
      "label": "Lookarounds, pyre2",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Backreferences, pyre2",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Unicode properties, pyre2",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Install, pyre2",
      "display": "pip install pyre2",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "What it does, pyre2",
      "display": "Wraps Google’s RE2 engine behind a Python regular-expression interface.",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "strengths lead, pyre2",
      "display": "Can reject engine fallback",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "strengths, pyre2",
      "display": "Set FALLBACK_EXCEPTION when unsupported patterns must raise instead of switching engines.",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths lead, pyre2",
      "display": "Matches Unicode property classes",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths, pyre2",
      "display": "Use named Unicode classes such as Greek in patterns.",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "limitations lead, pyre2",
      "display": "Unsupported patterns switch engines",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "limitations, pyre2",
      "display": "Patterns outside RE2’s syntax fall back to Python re.",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations lead, pyre2",
      "display": "Byte input produces byte offsets",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations, pyre2",
      "display": "Match offsets refer to bytes when matching UTF-8 byte strings.",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "Quickstart, pyre2",
      "display": "import re2\nre2.set_fallback_notification(re2.FALLBACK_WARNING)\ntype(re2.compile(r\"foo\"))\ntype(re2.compile(r\"foo(?!bar)\"))\nre2.search(u'ü'.encode('utf8'), u'Mötley Crüe'.encode('utf8'), flags=re2.UNICODE)\nre2.search(u'ü', u'Mötley Crüe', flags=re2.UNICODE)\n",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "Library name, pyperscan",
      "display": "pyperscan",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Monthly downloads, pyperscan",
      "display": "49.3K",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "License, pyperscan",
      "display": "MIT OR Apache-2.0",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Package release, pyperscan",
      "display": "0.4.0, Oct 2026",
      "asOf": "2026-10-06"
    },
    "F50": {
      "label": "Package release date, pyperscan",
      "display": "Oct 2026",
      "asOf": "2026-10-06"
    },
    "F51": {
      "label": "Repository stars, pyperscan",
      "display": "17",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Unicode properties, pyperscan",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F53": {
      "label": "Install, pyperscan",
      "display": "pip install pyperscan",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "What it does, pyperscan",
      "display": "Provides Python bindings to the Hyperscan pattern-scanning engine.",
      "asOf": "2026-11-17"
    },
    "F55": {
      "label": "strengths lead, pyperscan",
      "display": "Combines multiple tagged patterns",
      "asOf": "2026-11-17"
    },
    "F56": {
      "label": "strengths, pyperscan",
      "display": "Build a pattern database and identify matches through their tags.",
      "asOf": "2026-11-17"
    },
    "F57": {
      "label": "strengths lead, pyperscan",
      "display": "Supports incremental stream scanning",
      "asOf": "2026-11-17"
    },
    "F58": {
      "label": "strengths, pyperscan",
      "display": "Use StreamDatabase when matching data across stream chunks.",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "limitations lead, pyperscan",
      "display": "Start offsets need a flag",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "limitations, pyperscan",
      "display": "Set SOM_LEFTMOST when callbacks need the match’s start offset.",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "Quickstart, pyperscan",
      "display": "import pyperscan as ps\n\ndb = ps.BlockDatabase(  # (1)!\n    ps.Pattern(b\"foo.*bar\", ps.Flag.SOM_LEFTMOST),\n    ps.Pattern(b\"bar.*foo\", ps.Flag.SOM_LEFTMOST, ps.Flag.DOTALL, tag=\"tag\"),  # (2)!\n)\n\ndef on_match(ctx, tag, start, end):  # (3)!\n    #        ─┬─  ─┬─  ──┬──  ─┬─\n    #         │    │     │     └ match end index\n    #         │    │     └ match start index (needs SOM_LEFTMOST flag)\n    #         │    └ pattern tag, or index\n    #         └ arbitrary object to store state\n    return ps.Scan.Continue  # (4)!\n\nctx = ...  # (5)!\nscanner = db.build(ctx, on_match)  # (6)!\n\nscanner.scan(b\"foobar\")  # (7)!\n\n",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "Project function, pyperscan",
      "display": "@lru_cache\ndef build_hyperscan_database(handlers: Handlers) -> StreamDatabase:\n    patterns = []\n    for handler_class in handlers:\n        handler = handler_class()\n        for pattern in handler.PATTERNS:\n            try:\n                patterns.append(\n                    Pattern(\n                        pattern.as_regex(),\n                        Flag.SOM_LEFTMOST,\n                        Flag.DOTALL,\n                        tag=handler,\n                    )\n                )\n            except InvalidHexString as e:\n                logger.error(\n                    \"Invalid pattern\",\n                    handler=handler.NAME,\n                    pattern=pattern,\n                    error=str(e),\n                )\n                raise\n    return StreamDatabase(*patterns)\n",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "Project function reference, pyperscan",
      "display": "finder.py · build_hyperscan_database()",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "Project repository, pyperscan",
      "display": "onekey-sec/unblob",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "Project stars, onekey-sec/unblob",
      "display": "2.7K",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "Project push date, onekey-sec/unblob",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F67": {
      "label": "Library name, re",
      "display": "re",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "Monthly downloads, re",
      "display": "Standard library",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "License, re",
      "display": "PSF License Version 2",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "Package release, re",
      "display": "With Python",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Undated package release, re",
      "display": "With Python",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Repository context, re",
      "display": "Part of Python",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Lookarounds, re",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Backreferences, re",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Install, re",
      "display": "Bundled with Python",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "What it does, re",
      "display": "Provides Python’s standard-library regular-expression operations.",
      "asOf": "2026-11-17"
    },
    "F77": {
      "label": "strengths lead, re",
      "display": "Uses Python’s standard-library engine",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "strengths, re",
      "display": "Match text without installing another regular-expression package.",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "strengths lead, re",
      "display": "Supports named-group backreferences",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "strengths, re",
      "display": "Match text previously captured by a named group.",
      "asOf": "2026-11-17"
    },
    "F81": {
      "label": "limitations lead, re",
      "display": "Repeated groups retain final captures",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "limitations, re",
      "display": "Accessing a repeated group returns its final match.",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "limitations lead, re",
      "display": "Patterns and inputs must agree",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "limitations, re",
      "display": "Use matching string or bytes types for patterns, inputs and replacements.",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "Quickstart, re",
      "display": "from typing import NamedTuple\nimport re\n\nclass Token(NamedTuple):\n    type: str\n    value: int | float | str\n    line: int\n    column: int\n\ndef tokenize(code):\n    keywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}\n    token_specification = [\n        ('NUMBER',   r'\\d+(\\.\\d*)?'),  # Integer or decimal number\n        ('ASSIGN',   r':='),           # Assignment operator\n        ('END',      r';'),            # Statement terminator\n        ('ID',       r'[A-Za-z]+'),    # Identifiers\n        ('OP',       r'[+\\-*/]'),      # Arithmetic operators\n        ('NEWLINE',  r'\\n'),           # Line endings\n        ('SKIP',     r'[ \\t]+'),       # Skip over spaces and tabs\n        ('MISMATCH', r'.'),            # Any other character\n    ]\n    tok_regex = '|'.join('(?P<%s>%s)' % pair for pair in token_specification)\n    line_num = 1\n    line_start = 0\n    for mo in re.finditer(tok_regex, code):\n        kind = mo.lastgroup\n        value = mo.group()\n        column = mo.start() - line_start\n        if kind == 'NUMBER':\n            value = float(value) if '.' in value else int(value)\n        elif kind == 'ID' and value in keywords:\n            kind = value\n        elif kind == 'NEWLINE':\n            line_start = mo.end()\n            line_num += 1\n            continue\n        elif kind == 'SKIP':\n            continue\n        elif kind == 'MISMATCH':\n            raise RuntimeError(f'{value!r} unexpected on line {line_num}')\n        yield Token(kind, value, line_num, column)\n\nstatements = '''\n    IF quantity THEN\n        total := total + price * quantity;\n        tax := price * 0.05;\n    ENDIF;\n'''\n\nfor token in tokenize(statements):\n    print(token)\n\n",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "Project function, re",
      "display": "def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, flags=re.NOFLAG, group=None):\n    \"\"\"\n    Perform a regex search on the given string, using a single or a list of\n    patterns returning the first matching group.\n    In case of failure return a default value or raise a WARNING or a\n    RegexNotFoundError, depending on fatal, specifying the field name.\n    \"\"\"\n    if string is None:\n        mobj = None\n    elif isinstance(pattern, (str, re.Pattern)):\n        mobj = re.search(pattern, string, flags)\n    else:\n        for p in pattern:\n            mobj = re.search(p, string, flags)\n            if mobj:\n                break\n\n    _name = self._downloader._format_err(name, self._downloader.Styles.EMPHASIS)\n\n    if mobj:\n        if group is None:\n            # return the first matching group\n            return next(g for g in mobj.groups() if g is not None)\n        elif isinstance(group, (list, tuple)):\n            return tuple(mobj.group(g) for g in group)\n        else:\n            return mobj.group(group)\n    elif default is not NO_DEFAULT:\n        return default\n    elif fatal:\n        raise RegexNotFoundError(f'Unable to extract {_name}')\n    else:\n        self.report_warning(f'unable to extract {_name}' + bug_reports_message())\n        return None\n",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "Project function reference, re",
      "display": "common.py · _search_regex()",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "Project repository, re",
      "display": "yt-dlp/yt-dlp",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "Project stars, yt-dlp/yt-dlp",
      "display": "208.5K",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "Project push date, yt-dlp/yt-dlp",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F91": {
      "label": "Developer need",
      "display": "Bundled expression matching",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "Why choose re",
      "display": "the standard-library engine",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "Developer need in introduction",
      "display": "bundled expression matching",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "When to consider regex",
      "display": "repeated capture history is required",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Developer need",
      "display": "All captures from repeated groups",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "Why choose regex",
      "display": "the captures history API",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Developer need in introduction",
      "display": "all captures from repeated groups",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "When to consider re",
      "display": "the standard-library matching interface is sufficient",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Developer need",
      "display": "Rejecting RE2 fallback",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "Why choose pyre2",
      "display": "an explicit exception policy for unsupported patterns",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Developer need in introduction",
      "display": "rejecting RE2 fallback",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "When to consider regex",
      "display": "full Unicode case-folding is the main requirement",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Developer need",
      "display": "Tagged multi-pattern scans",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "Why choose pyperscan",
      "display": "one database with distinguishable pattern tags",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Developer need in introduction",
      "display": "tagged multi-pattern scans",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "When to consider re",
      "display": "named backreferences fit the pattern more closely",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Page introduction",
      "display": "Python regular-expression libraries let developers match and extract text with regular expressions.",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "FAQ: Which regular-expression engine is bundled with Python?",
      "display": "re supplies Python’s standard-library expression operations.",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "FAQ: Which regular-expression engine is bundled with Python?",
      "display": "The standard library is distributed with Python.",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "FAQ: Can re mix a bytes pattern with a Unicode string?",
      "display": "Pattern, input, and replacement types must agree; Unicode strings and bytes cannot be mixed.",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "FAQ: Does a repeated re group return every captured value?",
      "display": "Only the last capture of a repeatedly matched group is accessible.",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "FAQ: How can regex retain every repeated named capture?",
      "display": "Its captures method returns the capture history for a named group.",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "FAQ: Does regex fuzzy matching automatically choose the best match?",
      "display": "BESTMATCH changes fuzzy matching from the next match to the best match.",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "FAQ: Does FULLCASE alone enable case-insensitive matching?",
      "display": "FULLCASE affects IGNORECASE behavior but does not itself enable case-insensitive matching.",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "FAQ: Can concurrent regex matching safely modify its input?",
      "display": "Behavior is undefined if the input string changes during matching while the GIL is released.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: Does pyre2 always execute patterns through its native engine?",
      "display": "Unsupported constructs fall back to the original re module.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: Does pyre2 always execute patterns through its native engine?",
      "display": "Fallback notifications can be configured to raise an exception instead.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: Why do pyre2 byte and Unicode match offsets differ?",
      "display": "Match indices refer to the byte string when matching bytes; Unicode input avoids that offset interpretation.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: Can pyperscan identify which pattern matched?",
      "display": "Pattern tags distinguish matches from different compiled patterns.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: What does a pyperscan callback need for match start offsets?",
      "display": "The start index requires SOM_LEFTMOST on the pattern.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Do all regex iterators support incremental stream scanning?",
      "display": "pyperscan declares StreamDatabase specifically for stream scanning.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Do all regex iterators support incremental stream scanning?",
      "display": "Its block workflow instead builds a BlockDatabase and feeds one buffer to the scanner.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "Library name, regex",
      "display": "regex",
      "asOf": "2026-11-20"
    },
    "F124": {
      "label": "Monthly downloads, regex",
      "display": "391.9M",
      "asOf": "2026-11-20"
    },
    "F125": {
      "label": "License, regex",
      "display": "Apache-2.0 AND CNRI-Python",
      "asOf": "2026-11-20"
    },
    "F126": {
      "label": "Package release, regex",
      "display": "2026.11.15",
      "asOf": "2026-11-20"
    },
    "F127": {
      "label": "Package release date, regex",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F128": {
      "label": "Install, regex",
      "display": "python -m pip install regex==2026.11.15",
      "asOf": "2026-11-20"
    },
    "F129": {
      "label": "Quickstart, regex",
      "display": "import regex\n\nprint(regex.search(r\"\\w+\", \"hello\").group())\n",
      "asOf": "2026-11-20"
    },
    "F130": {
      "label": "Streaming scan state, regex",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "Replacement API, regex",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "Multi-pattern database, regex",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Engine and matching contract, regex",
      "display": "Python re-style matching with capture histories,Unicode options,partial matching,fuzzy edit constraints,and per-operation timeout support. Pattern semantics and flag values must be checked rather than assumed identical to stdlib.",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Project function, regex",
      "display": "def compile(pattern, flags=0, timeout=_UNSET):\n    r\"\"\"Compile ``pattern`` with the :mod:`regex` engine and wrap it so every\n    match runs under a wall-clock timeout.\n\n    :param pattern: a regular-expression string, or an already-compiled\n        ``re``/``regex`` pattern (its ``.pattern`` is re-compiled with\n        ``regex``), or an existing :class:`TimedPattern` (returned as-is with\n        the requested timeout).\n    :param flags: regex flags (stdlib ``re`` flag constants are accepted).\n    :param timeout: default wall-clock limit for matches on the returned\n        pattern; ``None`` disables it. Omit to use :data:`DEFAULT_TIMEOUT` at\n        match time (so a later change to that module attribute still applies).\n    :rtype: TimedPattern\n    \"\"\"\n    if isinstance(pattern, TimedPattern):\n        if timeout is _UNSET:\n            return pattern\n        return TimedPattern(pattern._rx, timeout)\n    # Accept a pre-compiled ``re``/``regex`` pattern by re-compiling its source.\n    src = getattr(pattern, \"pattern\", pattern)\n    check_pattern(src)\n    try:\n        compiled = regex.compile(src, flags)\n    except regex.error as exc:\n        # Normalise the engine's error to a re.error subclass so callers that\n        # catch re.error still work after moving off the stdlib module.\n        raise error(str(exc)) from exc\n    return TimedPattern(compiled, timeout)",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Project source file, regex",
      "display": "nltk/redos.py",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Project full_name, regex",
      "display": "nltk/nltk",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Project stargazers_count, regex",
      "display": "14.8K",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Library name, google-re2",
      "display": "google-re2",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Monthly downloads, google-re2",
      "display": "25.0M",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "License, google-re2",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Package release, google-re2",
      "display": "1.1.20251105",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Package release date, google-re2",
      "display": "Nov 2025",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Install, google-re2",
      "display": "python -m pip install google-re2==1.1.20251105",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Quickstart, google-re2",
      "display": "import re2\n\nprint(re2.search(r\"\\w+\", \"hello\").group())\n",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Official description, google-re2",
      "display": "Binds Google's RE2 engine to Python.",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Quickstart source file, google-re2",
      "display": "python/re2.py",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Streaming scan state, google-re2",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Replacement API, google-re2",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Multi-pattern database, google-re2",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Engine and matching contract, google-re2",
      "display": "Official RE2 Python binding with explicit Options,compiled expressions,Set,and Filter. Backreferences/lookaround are rejected by the engine; it has no automatic stdlib fallback. Shares import re2 with two unrelated Python distributions.",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Project function, google-re2",
      "display": "def filter_pattern_validator(value: str) -> \"re2._Regexp[str]\":\n    try:\n        # Do not write errors to stderr (this still raises exceptions)\n        options = re2.Options()\n        options.log_errors = False\n\n        regex = re2.compile(value, options=options)\n    except re2.error as e:\n        if len(e.args) >= 1:\n            if isinstance(e.args[0], str):  # nocoverage\n                raise ValidationError(_(\"Bad regular expression: {regex}\").format(regex=e.args[0]))\n            if isinstance(e.args[0], bytes):\n                raise ValidationError(\n                    _(\"Bad regular expression: {regex}\").format(regex=e.args[0].decode())\n                )\n        raise ValidationError(_(\"Unknown regular expression error\"))  # nocoverage\n\n    return regex",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Project source file, google-re2",
      "display": "zerver/models/linkifiers.py",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Project full_name, google-re2",
      "display": "zulip/zulip",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Project stargazers_count, google-re2",
      "display": "26.3K",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Library name, hyperscan",
      "display": "hyperscan",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Monthly downloads, hyperscan",
      "display": "830.6K",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "License, hyperscan",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Package release, hyperscan",
      "display": "0.9.1",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Package release date, hyperscan",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Install, hyperscan",
      "display": "python -m pip install hyperscan==0.9.1",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Quickstart, hyperscan",
      "display": "import hyperscan\n\ndb = hyperscan.Database()\ndb.compile(expressions=[b\"foo\"], ids=[0])\ndb.scan(b\"foobar\", match_event_handler=lambda *event: print(event))\n",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Official description, hyperscan",
      "display": "Binds the Hyperscan engine to Python.",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Quickstart source file, hyperscan",
      "display": "usage/",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Streaming scan state, hyperscan",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Replacement API, hyperscan",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Multi-pattern database, hyperscan",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Engine and matching contract, hyperscan",
      "display": "Callback-based multi-expression matching with block,stream,and vectored modes,serialization,and a separate Chimera mode. Current wheels vendor Vectorscan or platform-specific Hyperscan; wrapper API license and bundled-engine licensing are separate facts.",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Project function, hyperscan",
      "display": "def _build_regex_and_lookup(self):\n    logger.debug(\n        f\"start build regex for glossary {self.name} with {len(self.entries)} entries\"\n    )\n    \"\"\"\n    Builds a combined regex for all source terms and a lookup dictionary\n    from normalized source terms to (original_source, original_target).\n    Regex patterns are sorted by length in descending order to prioritize longer matches.\n    \"\"\"\n    self.normalized_lookup = {}\n\n    if not self.entries:\n        self.source_terms_regex = None\n        return\n\n    self.hs_dbs = []\n    hs_pattern = []\n    start = time.time()\n    for idx, entry in enumerate(self.entries):\n        normalized_key = self.normalize_source(entry.source)\n        self.normalized_lookup[normalized_key] = (entry.source, entry.target)\n        self.id_lookup.append((entry.source, entry.target))\n\n        hs_pattern.append((re.escape(entry.source).encode(\"utf-8\"), idx))\n\n    chunk_size = 20000\n    for i, pattern_chunk in enumerate(\n        batched(hs_pattern, chunk_size, strict=False)\n    ):\n        logger.debug(\n            f\"building hs_db chunk {i + 1} / {len(self.entries) // chunk_size + 1}\"\n        )\n        expressions, ids = zip(*pattern_chunk, strict=False)\n\n        hs_db = hyperscan.Database()\n        hs_db.compile(\n            expressions=expressions,\n            ids=ids,\n            elements=len(pattern_chunk),\n            flags=hyperscan.HS_FLAG_CASELESS | hyperscan.HS_FLAG_SINGLEMATCH,\n            # | hyperscan.HS_FLAG_UTF8\n            # | hyperscan.HS_FLAG_UCP,\n        )\n        self.hs_dbs.append(hs_db)\n\n    end = time.time()\n    logger.debug(\n        f\"finished building regex for glossary {self.name} in {end - start:.2f} seconds\"\n    )\n    logger.debug(\n        f\"build hs database for glossary {self.name} with {len(self.entries)} entries, hs_info: {self.hs_dbs[0].info()}\"\n    )\n    if not self.hs_dbs:\n        self.hs_dbs = None",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Project source file, hyperscan",
      "display": "babeldoc/glossary.py",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Project full_name, hyperscan",
      "display": "funstory-ai/BabelDOC",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Project stargazers_count, hyperscan",
      "display": "9.9K",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Library name, pyre2",
      "display": "pyre2",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Monthly downloads, pyre2",
      "display": "315.2K",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "License, pyre2",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Package release, pyre2",
      "display": "0.3.14",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Package release date, pyre2",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Install, pyre2",
      "display": "python -m pip install pyre2==0.3.14",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Quickstart, pyre2",
      "display": "import re2\n\nprint(re2.search(r\"\\w+\", \"hello\").group())\n",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Streaming scan state, pyre2",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Replacement API, pyre2",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Multi-pattern database, pyre2",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Engine and matching contract, pyre2",
      "display": "Cython RE2 binding with re-style flags and matching/replacement functions. Unsupported patterns can fall back to stdlib re by default; FALLBACK_EXCEPTION can reject fallback. Shares import re2 with google-re2 and legacy re2.",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Project function, pyre2",
      "display": "def regex_match(rule_regex: str, local):\n    regex = re2.compile(rule_regex)\n    try:\n        if re2.fullmatch(regex, local):\n            return True\n    except TypeError:  # re2 bug \"Argument 'pattern' has incorrect type (expected bytes, got PythonRePattern)\"\n        LOG.w(\"use re instead of re2 for %s %s\", rule_regex, local)\n        regex = re.compile(rule_regex)\n        if re.fullmatch(regex, local):\n            return True\n    return False",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Project source file, pyre2",
      "display": "app/regex_utils.py",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Project full_name, pyre2",
      "display": "simple-login/app",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Project stargazers_count, pyre2",
      "display": "7.2K",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Library name, onigurumacffi",
      "display": "onigurumacffi",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Monthly downloads, onigurumacffi",
      "display": "280.7K",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "License, onigurumacffi",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Package release, onigurumacffi",
      "display": "1.5.0",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Package release date, onigurumacffi",
      "display": "Jan 2026",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Install, onigurumacffi",
      "display": "python -m pip install onigurumacffi==1.5.0",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Quickstart, onigurumacffi",
      "display": "import onigurumacffi\n\npattern = onigurumacffi.compile(r\"\\w+\")\nprint(pattern.search(\"hello\").group())\n",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "Official description, onigurumacffi",
      "display": "Binds the Oniguruma regex engine to Python through cffi.",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Quickstart source file, onigurumacffi",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Streaming scan state, onigurumacffi",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Replacement API, onigurumacffi",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Multi-pattern database, onigurumacffi",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Engine and matching contract, onigurumacffi",
      "display": "Focused Oniguruma compile/match/search interface plus compiled RegSet matching,with character-based exposed match positions. It is not a full stdlib replacement and has no native search-and-replace loop.",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Project function, onigurumacffi",
      "display": "def search(\n        self,\n        line: str,\n        pos: int,\n        first_line: bool,\n        boundary: bool,\n) -> Match[str] | None:\n    return self._reg.search(line, pos, flags=_FLAGS[first_line, boundary])",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Project source file, onigurumacffi",
      "display": "babi/reg.py",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Project full_name, onigurumacffi",
      "display": "asottile/babi",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Project stargazers_count, onigurumacffi",
      "display": "490",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Library name, pyperscan",
      "display": "pyperscan",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Monthly downloads, pyperscan",
      "display": "50.6K",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "License, pyperscan",
      "display": "MIT OR Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Package release, pyperscan",
      "display": "0.4.0",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Package release date, pyperscan",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Install, pyperscan",
      "display": "python -m pip install pyperscan==0.4.0",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Quickstart, pyperscan",
      "display": "import pyperscan as ps\n\ndef on_match(context, tag, start, end):\n    context.append((tag, start, end))\n    return ps.Scan.Continue\n\nmatches = []\ndb = ps.BlockDatabase(ps.Pattern(b\"foo\", ps.Flag.SOM_LEFTMOST))\nscanner = db.build(matches, on_match)\nscanner.scan(b\"foobar\")\nprint(matches)\n",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Streaming scan state, pyperscan",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Replacement API, pyperscan",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Multi-pattern database, pyperscan",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Engine and matching contract, pyperscan",
      "display": "Typed Pattern and database/scanner interfaces with arbitrary pattern tags and explicit callback continuation,including streaming. Different API from the separately published hyperscan package; does not return a stdlib Match object.",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Project function, pyperscan",
      "display": "@lru_cache\ndef build_hyperscan_database(handlers: Handlers) -> StreamDatabase:\n    patterns = []\n    for handler_class in handlers:\n        handler = handler_class()\n        for pattern in handler.PATTERNS:\n            try:\n                patterns.append(\n                    Pattern(\n                        pattern.as_regex(),\n                        Flag.SOM_LEFTMOST,\n                        Flag.DOTALL,\n                        tag=handler,\n                    )\n                )\n            except InvalidHexString as e:\n                logger.error(\n                    \"Invalid pattern\",\n                    handler=handler.NAME,\n                    pattern=pattern,\n                    error=str(e),\n                )\n                raise\n    return StreamDatabase(*patterns)",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Project source file, pyperscan",
      "display": "python/unblob/finder.py",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Project full_name, pyperscan",
      "display": "onekey-sec/unblob",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Project stargazers_count, pyperscan",
      "display": "2.7K",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Library name, pcre2",
      "display": "pcre2",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Monthly downloads, pcre2",
      "display": "39.4K",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "License, pcre2",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Package release, pcre2",
      "display": "0.7.1",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Package release date, pcre2",
      "display": "Jul 2026",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Install, pcre2",
      "display": "python -m pip install pcre2==0.7.1",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Quickstart, pcre2",
      "display": "import pcre2\n\npattern = pcre2.compile(r\"\\w+\")\nprint(pattern.search(\"hello\").group())\n",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Official description, pcre2",
      "display": "Binds the PCRE2 regular expression library to Python.",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Quickstart source file, pcre2",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Streaming scan state, pcre2",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Replacement API, pcre2",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "Multi-pattern database, pcre2",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Engine and matching contract, pcre2",
      "display": "PCRE2 pattern/match interface with optional JIT,substitution,iterators,and callouts. PCRE2 replacement syntax and regex semantics can differ from Python re; published package/source-build prerequisites remain explicit.",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Library name, re2",
      "display": "re2",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "Monthly downloads, re2",
      "display": "4.6K",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "License, re2",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Package release, re2",
      "display": "0.2.24",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Package release date, re2",
      "display": "Feb 2019",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Install, re2",
      "display": "python -m pip install re2==0.2.24",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Quickstart, re2",
      "display": "import re2\n\nprint(re2.search(r\"\\w+\", \"hello\").group())\n",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "Official description, re2",
      "display": "Wraps Google's RE2 engine through Cython.",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Quickstart source file, re2",
      "display": "README.rst",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "Streaming scan state, re2",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "Replacement API, re2",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "Multi-pattern database, re2",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Engine and matching contract, re2",
      "display": "Legacy axiak Cython RE2 distribution whose latest artifact is0.2.24. Native unsupported-pattern handling can fall back to stdlib re; source build requires RE2,Python headers,and C++ tooling. Age is retained as a date,not fabricated deprecation evidence.",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python regex libraries re regex pyre2 pyperscan code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
