Skip to content

Fix adjacent tag matching in ReprHighlighter#4147

Open
mariettakyriazi wants to merge 1 commit into
Textualize:masterfrom
mariettakyriazi:fix-repr-highlighter-tags-4035
Open

Fix adjacent tag matching in ReprHighlighter#4147
mariettakyriazi wants to merge 1 commit into
Textualize:masterfrom
mariettakyriazi:fix-repr-highlighter-tags-4035

Conversation

@mariettakyriazi
Copy link
Copy Markdown

@mariettakyriazi mariettakyriazi commented May 28, 2026

Closes #4035

This PR fixes adjacent tag matching in ReprHighlighter.

Previously, the regex used a greedy match for tag contents, causing adjacent tags such as:

content1content2

to be merged into a single match.

The regex has been updated to correctly handle adjacent tags while preserving existing behavior.

Changes:

  • Updated tag matching regex in rich/highlighter.py
  • Added a regression test covering adjacent tags

Testing:
python -m pytest tests/test_highlighter.py

Result:
84 tests passed.

@mariettakyriazi mariettakyriazi force-pushed the fix-repr-highlighter-tags-4035 branch from ab84910 to 3bd56b5 Compare May 28, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReprHighlighter tag regex merges adjacent tags due to greedy [\w\W]*

1 participant