Regex & property sheet
-
Upload
youngkwon-lee -
Category
Documents
-
view
1.111 -
download
4
Transcript of Regex & property sheet
![Page 1: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/1.jpg)
Regex & Property Sheethttp://whiletrue0222.com/
@whiletrue0222
http://cafe.naver.com/architect1
아꿈사
2012. 09. 01
http://www.flickr.com/photos/jacqueline-w/2837089885/sizes/l/in/photostream/
![Page 2: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/2.jpg)
목록• 정규표현식을 활용한 찾기 및 바꾸기
• Property Sheet 를 활용하자 .
![Page 3: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/3.jpg)
정규 표현식이란
http://ko.wikipedia.org/wiki/%EC%A0%95%EA%B7%9C%ED%91%9C%ED%98%84%EC%8B%9D
![Page 4: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/4.jpg)
Visual Studio 에서 정규식 사용
정규식을 쓰려면 체크
기본적인 구문몇 개만 나온다 .
![Page 5: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/5.jpg)
어느 날 갑자기 팀장님이 부르신다 ..
한글로 된 로그 전부 영어로 바꾸란다 .
작성된 로그가 수천 개가 된다 !
한글로 된 것을 언제 다 일일이 찾지 ?
그냥 예제를 위한 예시상황입니다 .
![Page 6: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/6.jpg)
로그코드는 대략 이렇게 ..
WriteLog(“ 로그메시지” );
![Page 7: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/7.jpg)
코드 구문 분석
WriteLog(“ 로그메시지” );
문자열함수 이름
![Page 8: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/8.jpg)
WriteLog.*:Ha
WriteLog(“ 로그메시지” );
찾는 정규식찾을 코드
찾는 정규식
![Page 9: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/9.jpg)
WriteLog.*:Ha
WriteLog(“ 로그메시지” );
함수이름이 일치하고
![Page 10: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/10.jpg)
WriteLog.*:Ha
WriteLog(“ 로그메시지” );
중간에 문자들이 있고
식 구문 구문단일 문자 . 줄 바꿈 문자를 제외한 모든 단일 문자0 이상 * 앞의 식을 0 번 이상 찾습니다 .
![Page 11: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/11.jpg)
한글이 있다 .
WriteLog.*:Ha
WriteLog(“ 로그메시지” );
식 구문 구문한글 :Ha 한글 및 조합 자모를 찾습니다 .
![Page 12: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/12.jpg)
Visual Studio 에서 검색하면 .
정규식에 일치하는문자열들
![Page 13: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/13.jpg)
팀장님이 또 부르신다… ..
strcpy 를 strncpy_s 로 전부 바꾸거라 .
그냥 예제를 위한 예시상황입니다 .
![Page 14: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/14.jpg)
strcpy( dest, src );
strncpy_s( dest, src, count );
함수 차이점
count 변수 추가
함수명이 다름
![Page 15: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/15.jpg)
strcpy( dest, src );
정규식으로 찾기
strcpy{.*}{\)}
함수이름을 찾고
![Page 16: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/16.jpg)
strcpy( dest, src );
strcpy{.*}{\)}
기존 매개변수 찾고
{} - 태그식 뒤에서 설명합니다 .
![Page 17: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/17.jpg)
strcpy( dest, src );
strcpy{.*}{\)}
닫기 괄호를 찾는다
![Page 18: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/18.jpg)
strcpy( dest, src );
strcpy{.*}{\)}
strncpy_s\1, _TRUNCATE\2
바꾸기
함수 이름을 변경
![Page 19: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/19.jpg)
strcpy( dest, src );
strcpy{.*}{\)}
strncpy_s\1, _TRUNCATE\2
매개변수를 대입
![Page 20: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/20.jpg)
strcpy( dest, src );
strcpy{.*}{\)}
strncpy_s\1, _TRUNCATE\2
Count 를 추가
![Page 21: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/21.jpg)
strcpy( dest, src );
strcpy{.*}{\)}
strncpy_s\1, _TRUNCATE\2
닫기 괄호를 대입
![Page 22: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/22.jpg)
결과
![Page 23: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/23.jpg)
주의
앞서 설명한 정규식은 단순하여
실제로 사용할 때는 여러 상황을
고려해서 식을 만들어야 한다 .
![Page 24: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/24.jpg)
목록• 정규표현식을 활용한 찾기 및 바꾸기
• 속성 시트 (Property Sheet) 를 활용하자 .
![Page 25: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/25.jpg)
속성 시트 (Property Sheet)
http://msdn.microsoft.com/ko-kr/library/a4xbdz1e(v=vs.100).aspx
![Page 26: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/26.jpg)
다수의 프로젝트를 각각 설정 ?
각각 설정하면 고생 .디렉터리 구조 변경되면 눈물 .실수 위험도 높다 .
속성시트를 활용하자 .
Ogre 1.8 sample
Ogre 는 Cmake 를
사용해서 속성시트가
없답니다 .
![Page 27: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/27.jpg)
속성시트 적용 전
중복
![Page 28: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/28.jpg)
속성시트 적용 후
중복제거
![Page 29: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/29.jpg)
_UNICODE 전처리기는어디에 선언 되어있나 ?
![Page 30: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/30.jpg)
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0 ( 제 컴 기준 )
_UNICODE 정의됨
![Page 31: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/31.jpg)
속성관리자• 보기 -> 속성관리자 창에서
추가 가능
• 대부분의 프로젝트 설정을 상속시킬 수 있다 .
![Page 32: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/32.jpg)
참고• List of regular expression software– http://en.wikipedia.org/wiki/List_of_regul
ar_expression_software
• 정규식 (Visual Studio)– http://msdn.microsoft.com/ko-kr/library/
2k3te2cs(v=vs.100).aspx
• 속성 시트 (C++)– http://msdn.microsoft.com/ko-kr/library/
a4xbdz1e(v=vs.100).aspx
![Page 33: Regex & property sheet](https://reader031.fdocument.pub/reader031/viewer/2022020105/5588f892d8b42a0b688b45b7/html5/thumbnails/33.jpg)
감사합니다 .