|
@@ -123,7 +123,8 @@
|
|
|
$cleanContent = trim($cleanContent);
|
|
$cleanContent = trim($cleanContent);
|
|
|
$options = $q->options ?? [];
|
|
$options = $q->options ?? [];
|
|
|
if (empty($options)) {
|
|
if (empty($options)) {
|
|
|
- $pattern = '/([A-D])[\.、:.:]\s*(.+?)(?=\s*[A-D][\.、:.:]|$)/su';
|
|
|
|
|
|
|
+ // 【修复】选项标记必须在行首或空白后,避免误匹配 SVG 注释中的 BD:DC 等内容
|
|
|
|
|
+ $pattern = '/(?:^|\s)([A-D])[\.、:.:]\s*(.+?)(?=(?:^|\s)[A-D][\.、:.:]|$)/su';
|
|
|
if (preg_match_all($pattern, $cleanContent, $matches, PREG_SET_ORDER)) {
|
|
if (preg_match_all($pattern, $cleanContent, $matches, PREG_SET_ORDER)) {
|
|
|
foreach ($matches as $match) {
|
|
foreach ($matches as $match) {
|
|
|
$optionText = trim($match[2]);
|
|
$optionText = trim($match[2]);
|
|
@@ -135,7 +136,8 @@
|
|
|
}
|
|
}
|
|
|
$stemLine = $cleanContent;
|
|
$stemLine = $cleanContent;
|
|
|
if (!empty($options)) {
|
|
if (!empty($options)) {
|
|
|
- if (preg_match('/^(.+?)(?=[A-D][\.、:.:])/su', $cleanContent, $stemMatch)) {
|
|
|
|
|
|
|
+ // 【修复】只匹配行首或空白后的选项标记,避免误匹配 SVG 注释中的 BD:DC 等内容
|
|
|
|
|
+ if (preg_match('/^(.+?)(?=(?:^|\s)[A-D][\.、:.:])/su', $cleanContent, $stemMatch)) {
|
|
|
$stemLine = trim($stemMatch[1]);
|
|
$stemLine = trim($stemMatch[1]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|