diff --git a/src/cleo/ui/table.py b/src/cleo/ui/table.py index cf3cc238..accaf547 100644 --- a/src/cleo/ui/table.py +++ b/src/cleo/ui/table.py @@ -376,7 +376,11 @@ def _render_cell(self, row: Row, column: int, cell_format: str) -> str: pad = style.pad if isinstance(cell, TableCell) and isinstance(cell.style, TableCellStyle): is_not_styled_by_tag = not re.match( - r"^<(\w+|(\w+=[\w,]+;?)*)>.+$", str(cell) + ( + r"^<(\w+|((?:fg|bg|options)=[\w,]+;?)+)>" + r".+<\/(\w+|((?:fg|bg|options)=[\w,]+;?)+)?>$" + ), + str(cell), ) if is_not_styled_by_tag: cell_format = (