
그래서 다음과 같은 줄이 있습니다.
text1:text2:text3
나는 이것을 다음과 같이 만들고 싶다 :
text1:text3
정규식을 사용하여 이를 수행하는 방법은 무엇입니까?
답변1
답변2
- Ctrl+H
- 무엇을 찾다:
:[^:\r\n]+(?=:)
- 다음으로 교체:
LEAVE EMPTY
- Replace all
설명:
: : a semicolon
[^:\r\n]+ : negative character class, any character that is not semicolon or linebreak
(?=:) : lookahead, make sure we have a semicolon after
- 정규식 확인