-2
다음 코드를 사용하여 전송을 분할합니다. 작동하지만 위의 경우에는 오류가 발생합니다. 이 아이디어를 얻을 수없는 이유는 무엇입니까?Regex이이 문장을 분할하지 않습니다
$re = '/# Split sentences on whitespace between them.
(?<= # Begin positive lookbehind.
[.!?:] # Either an end of sentence punct,
| [.!?:][\'"]
| [\r\t\n] # or end of sentence punct and quote.
) # End positive lookbehind.
(?<! # Begin negative lookbehind.
Mr\. # Skip either "Mr."
| Mrs\. # or "Mrs.",
| Ms\. # or "Ms.",
| Jr\. # or "Jr.",
| Dr\. # or "Dr.",
| Prof\. # or "Prof.",
| U\.S\.A\.
| Sr\. # or "Sr.",
| T\.V\.A\. # or "T.V.A.",
| a\.m\. # or "a.m.",
| p\.m\. # or "p.m.",
| a€¢\.
| :\.
| ?\.
# or... (you get the idea).
) # End negative lookbehind.
\s+ # Split on whitespace between sentences.
/ix';
$english = "Support services, such as help with transportation or clothing, may also be available. How do I receive these services?";
$english = preg_split($re, $row['english'], -1, PREG_SPLIT_NO_EMPTY);
print_r($english);
난 그냥 기준이 일치하는 경우에도이 오류가 계속
:
PHP Warning: preg_split(): Compilation failed: nothing to repeat at offset 736 in parse2.php on line 32
좋은 캐치. +1. – sln
감사합니다. 그건 아니야? 내가 사용하고 있던 원래 코드에서. 새로운 스크립트로 옮길 때 어떻게 든 바뀌 었습니다. 고마워요,이 머리 위에 많은 머리카락을 잃었어요. –