소프트웨어 정규표현식 질문입니다. 도움을 부탁드립니다. ^.^
2023.09.27 00:59
정규표현식 질문입니다. 도움을 부탁드립니다. ^.^
1,2번 중에서 1번의 정규식은 다음과 같습니다. 그런데 2는 중간에 "."가 있는 경우에는 정규식에서 제외하고 싶습니다. 이런 경우에는 어떻게 정규식을 해야 할 지 고수님의 한 수 지도를 부탁드립니다.
해피데이!
1. 한 문장 안에 "—"가 2개가 있는 경우에는 "—"albeit through different ways from those of science fiction"—"에 있어서 {albeit through different ways from those of science fiction}로 바꾸고 싶습니다.
1. The end of Griffin actually begins with his body decomposing, which leads to a progressive alteration in his state of consciousness and then to madness, ending finally with his death at the hands of a mob. The level of madness attained by Griffin calls to mind—albeit through different ways from those of science fiction—the particular fragmentation of the self of the person with schizophrenia.
찾기: ([a-z])—(.*?)—([a-z])
바꾸기: $1 {$2} $3
1. The end of Griffin actually begins with his body decomposing, which leads to a progressive alteration in his state of consciousness and then to madness, ending finally with his death at the hands of a mob. The level of madness attained by Griffin calls to mind {albeit through different ways from those of science fiction} the particular fragmentation of the self of the person with schizophrenia.
2. 한 문장 안에 "—"가 한 개만 있는 경우. "." 마침표를 기준으로 양쪽에 각각 한 문장 안에 "—"가 한개씩 있습니다. 이럴 경우에는 정규식을 적용할 필요가 없습니다.
2. The end of Griffin actually begins with his body decomposing, which leads to a progressive alteration in his state of consciousness and then to madness—ending finally with his death at the hands of a mob. The level of madness attained by Griffin calls to mind—albeit through different ways from those of science fiction the particular fragmentation of the self of the person with schizophrenia.
정규식에서 . 은 모든 한문자를 뜻합니다
정규식에서 "." 을 제외한 모든 문자는 [^\.] 입니다
.*? 대신 [^\.]*? 을 사용해보세요