목차

반응형



Replacing

Regular Expressions supports tagged expressions. This is accomplished using ( and ) to surround the text you want tagged, and then using \1 in the replace string to substitute the first matched text, \2 for the second, etc.

For example:

Text bodySearch stringReplace stringResult
Hi my name is Fredmy name is (.+)my name is not \1Hi my name is not Fred
The quick brown fox jumped over the fat lazy dogbrown (.+) jumped over the (.+)brown \2 jumped over the \1The quick brown fat jumped over the fox lazy dog

에디트플러스로 regex로 편히 수정을 하다보면 키워드를 찾은뒤에 가공이 필요할 때가 있다.

예를들자면

안녕하세요 김정은입니다.

안녕하세요 문재인입니다.

안녕하세요 홍준표입니다.

안녕하세요 닐리리아입니다.


이런상태에서 양식만 조금 바꾸고싶을때가 있을때

안녕 김정은이라고해

안녕 문재인이라고해

...

이렇게 바꾸고 싶을때는 냅두고 싶은 검색키워드를 ()로 감싸서 아래 바꿀 말에서 그룹 순서를 적어서 써먹을 수 있다.



주로 데이터 삽입하는 쿼리문 작성하거나 쿼리문 대량으로 수정할때 써먹을수있음

반응형