티스토리 뷰
using System.Text.RegularExpressions;
string[] parts = Regex.Split(mytext, "\.\n|\. ");
# or "\.\s" if you're not picky about it matching tabs, etc.
-------------------정규식
/\.\s/
.
뒤에 공백이 오는 리터럴과 일치합니다 .
이를 위해 정규 표현식이 필요하지 않습니다. 오버로드를 사용하면 string.Split
문자열 배열이 필요합니다.
string[] splitters = new string[] { ". ", ".\t", "." + Environment.NewLine };
string[] sentences = aText.Split(splitters, StringSplitOptions.None);
출처
https://stackoverflow.com/questions/1904905
댓글