fix:자막 정규식 lookbehind → \K 방식으로 변경 (멀티바이트 호환)

PCRE lookbehind는 멀티바이트 문자 클래스에서 가변길이 오류 발생
→ \K (match reset)로 대체하여 구두점은 앞 문장에 유지

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-15 14:38:04 +09:00
parent e9ad735be9
commit 073e4c4877

View File

@@ -306,9 +306,9 @@ private function splitIntoSentences(string $text): array
return [$text];
}
// 구두점 뒤 + 다음이 구두점이 아닐 때 + 공백 있을 때만 분리
// "정말요?!" → 분리 안 됨, "정말요?! 다음 문장" → 분리됨
$rawParts = preg_split('/(?<=[.!?。!?])(?![.!?。!?])\s+/u', $text, -1, PREG_SPLIT_NO_EMPTY);
// \K로 구두점은 앞 문장에 유지, 공백만 구분자로 소비
// "정말요?!" → 분리 안 됨, "정말요?! 다음 문장" → ["정말요?!", "다음 문장"]
$rawParts = preg_split('/[.!?。!?](?![.!?。!?])\K\s+/u', $text, -1, PREG_SPLIT_NO_EMPTY);
if (count($rawParts) <= 1) {
return [$text];