Home / Function/ _match_code() — langchain Function Reference

_match_code() — langchain Function Reference

Architecture documentation for the _match_code() function in markdown.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a98db0b3_1cd6_99eb_e5f6_1cfcd76b1885["_match_code()"]
  cd7394a9_9856_dc15_cb00_078cf42f0529["ExperimentalMarkdownSyntaxTextSplitter"]
  a98db0b3_1cd6_99eb_e5f6_1cfcd76b1885 -->|defined in| cd7394a9_9856_dc15_cb00_078cf42f0529
  ca4b44a0_217b_9ee3_738c_a86f47cf5d13["split_text()"]
  ca4b44a0_217b_9ee3_738c_a86f47cf5d13 -->|calls| a98db0b3_1cd6_99eb_e5f6_1cfcd76b1885
  7401677c_acf5_67de_69f0_eb4e531b0f66["_resolve_code_chunk()"]
  7401677c_acf5_67de_69f0_eb4e531b0f66 -->|calls| a98db0b3_1cd6_99eb_e5f6_1cfcd76b1885
  style a98db0b3_1cd6_99eb_e5f6_1cfcd76b1885 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/text-splitters/langchain_text_splitters/markdown.py lines 472–474

    def _match_code(line: str) -> re.Match[str] | None:
        matches = [re.match(rule, line) for rule in [r"^```(.*)", r"^~~~(.*)"]]
        return next((match for match in matches if match), None)

Subdomains

Frequently Asked Questions

What does _match_code() do?
_match_code() is a function in the langchain codebase, defined in libs/text-splitters/langchain_text_splitters/markdown.py.
Where is _match_code() defined?
_match_code() is defined in libs/text-splitters/langchain_text_splitters/markdown.py at line 472.
What calls _match_code()?
_match_code() is called by 2 function(s): _resolve_code_chunk, split_text.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free