$currentLineLength = 0;
preg_match_all("#<((
$openTagRegex) | /(
$closeTagRegex)?)>#ix",
$message,
$matches, \PREG_OFFSET_CAPTURE
);
foreach ($matches[0
] as $i =>
$match) { $pos =
$match[1
];
$text =
$match[0
];
if (0 !=
$pos && '\\' ==
$message[$pos - 1
]) { continue;
} // add the text up to the next tag
$output .=
$this->
applyCurrentStyle(substr($message,
$offset,
$pos -
$offset),
$output,
$width,
$currentLineLength);
$offset =
$pos + \
strlen($text);
// opening tag?
if ($open = '/' !==
$text[1
]) { $tag =
$matches[1
][$i][0
];
} else { $tag =
$matches[3
][$i][0
] ?? '';
} if (!
$open && !
$tag) { // </>