<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>양군이 놀이터</title>
<link>http://yanggoony.tistory.com/</link>
<description>유부남 양군의 서식지...</description>
<language>ko</language>
<pubDate>Mon, 30 May 2016 18:06:45 +0900</pubDate>
<generator>TISTORY</generator>
<managingEditor>양군이당</managingEditor>
<image>
<title>양군이 놀이터</title>
<url>http://cfs7.tistory.com/upload_control/download.blog?fhandle=YmxvZzIxMjUzN0BmczcudGlzdG9yeS5jb206L2F0dGFjaC8wLzAuanBn</url>
<link>http://yanggoony.tistory.com</link>
<description>유부남 양군의 서식지...</description>
</image>
<item>
<title>[Oracle] Timestamp의 Index Hint 특성</title>
<link>http://yanggoony.tistory.com/45</link>
<description>&lt;div&gt;
Oracle Table에 Timestamp Column에 Index 설정 후 해당 인덱스를 사용하여 Ordering 결과를 얻기 위해 Hint 를 주었을 경우 아무 조건절이 없으면 Order가 안되는 신기한 상황 발생.. ㅡ_ㅡ (기술 문서를 안 읽어봐서 정확한 이유는 확인하지 못했으나 당연히 될줄 알았던 것이 안되니 당황)&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
테이블 스키마와 인덱스 스키마는 아래와 같은 상황&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile9.uf.tistory.com/image/1463E7114C2D6B512C828C&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;table_schema.jpg&quot; height=&quot;364&quot; width=&quot;683&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile26.uf.tistory.com/image/1563E7114C2D6B512D5243&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;index_schema.jpg&quot; height=&quot;143&quot; width=&quot;683&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;일단 테스트&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SELECT&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /*+ INDEX_DESC(T_MORI I_MORI_START_TIME) */&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MORI_NO, TITLE, TITLE_IMG,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MORI_TYPE, START_TIME, END_TIME,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUBTITLE, SUBTITLE_IMG, MIN_CONTRACTOR,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX_CONTRACTOR, LIST_PRICE, DISCOUNT_PRICE,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DISCOUNT_RATE, CREATE_TIME, MODIFY_TIME,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AUTHOR_NO, DEPARTMENT_NO, SHORT_EXPLAIN&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FROM T_MORI&lt;/div&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Query 1&amp;gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;위와 같이 Index Hint를 줬을 경우 START_TIME 을 기준으로 최근 시간의 결과값이 처음 나오는 결과를 기대했으나 결과는...&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile8.uf.tistory.com/image/181763124C2D6CF64A5B85&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;result1.jpg&quot; height=&quot;129&quot; width=&quot;563&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
Index가 잘못되었나 싶어 Index Rebuild 실행도 해봤으나 결과는 동일... 다른 Index도 문제인가 싶어 Title Index를 이용한 Ordering 결과 확인&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
SELECT&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /*+ INDEX_DESC(T_MORI I_MORI_TITLE) */&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MORI_NO, TITLE, TITLE_IMG,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MORI_TYPE, START_TIME, END_TIME,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUBTITLE, SUBTITLE_IMG, MIN_CONTRACTOR,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX_CONTRACTOR, LIST_PRICE, DISCOUNT_PRICE,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DISCOUNT_RATE, CREATE_TIME, MODIFY_TIME,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AUTHOR_NO, DEPARTMENT_NO, SHORT_EXPLAIN&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FROM T_MORI&lt;/div&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Query 2&amp;gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile9.uf.tistory.com/image/1125D9124C2D6D840DE7A2&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;result2.jpg&quot; height=&quot;128&quot; width=&quot;561&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
기대한 결과가 정확히 나왔다...&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;Index가 제대로 안타는 것 같은 생각이 들어 Plan 확인.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile26.uf.tistory.com/image/144FAE0D4C2D6E0B0EB272&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;plan1.jpg&quot; height=&quot;122&quot; width=&quot;492&quot;/&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&amp;lt;Query1 의 Plan 결과&amp;gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile25.uf.tistory.com/image/154FAE0D4C2D6E0B0F950A&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;plan2.jpg&quot; height=&quot;142&quot; width=&quot;501&quot;/&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&amp;lt;Query2 의 Plan 결과&amp;gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;이럴수가.. ㅡ_ㅡ Timestamp 컬럼에 Index를 건 것은 Hint 까지 줬음에도 불구하고 Index를 타지 않고 Full Scan을 한다. 반면 varchar2 컬럼 Index를 이용한 Select의 경우 Index를 정확히 타서 descending 까지 거쳐 결과를 추출해 내었다.. ㅡ_ㅡ&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
하지만 꿋꿋하게 Timestamp 값을 기준으로 결과를 얻어내기 위해 다시 테스트 돌입.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
해당 컬럼에 비교값을 넣으면 어찌되었든 값을 비교해야 하므로 Index를 타지 않을까 하는 생각으로 해당 컬럼에 대한 조건값을 넣어봤음.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SELECT&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /*+ INDEX_DESC(T_MORI I_MORI_START_TIME) */&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MORI_NO, TITLE, TITLE_IMG,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MORI_TYPE, START_TIME, END_TIME,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUBTITLE, SUBTITLE_IMG, MIN_CONTRACTOR,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MAX_CONTRACTOR, LIST_PRICE, DISCOUNT_PRICE,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DISCOUNT_RATE, CREATE_TIME, MODIFY_TIME,&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AUTHOR_NO, DEPARTMENT_NO, SHORT_EXPLAIN&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FROM T_MORI&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(238, 238, 238); border-right-color: rgb(238, 238, 238); border-bottom-color: rgb(238, 238, 238); border-left-color: rgb(238, 238, 238); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;WHERE START_TIME &amp;lt; '2010-10-01';&lt;/div&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/image/142899224C2D779F30A8D4&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;result2.jpg&quot; height=&quot;128&quot; width=&quot;561&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;div class=&quot;imageblock center&quot; style=&quot;text-align: center; clear: both;&quot;&gt;&lt;img src=&quot;http://cfile2.uf.tistory.com/image/171EBC044C2D6FAB25335B&quot; alt=&quot;&quot; filemime=&quot;image/jpeg&quot; filename=&quot;plan3.jpg&quot; height=&quot;149&quot; width=&quot;645&quot;/&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
오홍~ 나이스.. 결과가 정확히 추출되었당. 어찌되었건 테이블 전체 Select 하는 상황이 아니므로 조건절을 주어 무조건 index를 한번 Access 하도록 하여 빠른 결과를 얻을 수 있었음.&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
결론! Timestamp Column 속성의 index 일 경우 조건절을 주어야 index를 타고 원하는 결과를 얻을 수 있다.&lt;/div&gt;&lt;div class=&quot;entry-ccl&quot; style=&quot;clear: both; text-align: right; margin-bottom: 10px&quot;&gt;
	&lt;a href=&quot;http://creativecommons.org/licenses/by/4.0/deed.ko&quot; target=&quot;_blank&quot; style=&quot;text-decoration: none&quot;&gt;
	&lt;img id=&quot;ccl-icon-45-0&quot; class=&quot;entry-ccl-by&quot; src=&quot;//i1.daumcdn.net/cfs.tistory/resource/4191/static/admin/editor/ccl_black01.png&quot; alt=&quot;저작자 표시&quot;/&gt;
	&lt;!--
	&lt;rdf:RDF xmlns=&quot;http://web.resource.org/cc/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
		&lt;Work rdf:about=&quot;&quot;&gt;
			&lt;license rdf:resource=&quot;http://creativecommons.org/licenses/by-fr/2.0/kr/&quot; /&gt;
		&lt;/Work&gt;
		&lt;License rdf:about=&quot;http://creativecommons.org/licenses/by-fr/&quot;&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Attribution&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/DerivativeWorks&quot;/&gt;
		&lt;/License&gt;
	&lt;/rdf:RDF&gt;
	--&gt;
	&lt;/a&gt;
&lt;/div&gt;
</description>
<category>Database</category>
<category>Database</category>
<category>hint</category>
<category>index</category>
<category>oracle</category>
<category>timestamp</category>
<author>양군이당</author>
<guid>http://yanggoony.tistory.com/45</guid>
<comments>http://yanggoony.tistory.com/45#entry45comment</comments>
<pubDate>Fri, 02 Jul 2010 14:26:02 +0900</pubDate>
</item>
<item>
<title>객체를 Json 형태로 출력하기</title>
<link>http://yanggoony.tistory.com/44</link>
<description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(102, 102, 102); font-family: dotum; &quot;&gt;&lt;div&gt;
&lt;font class=&quot;Apple-style-span&quot; size=&quot;4&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 16px; line-height: 24px;&quot;&gt;&lt;b&gt;출처 :&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-weight: normal; line-height: 18px; font-size: 12px; &quot;&gt;&lt;a href=&quot;http://devkkaok.tistory.com/92&quot;&gt;http://devkkaok.tistory.com/92&lt;/a&gt;&amp;nbsp;까오기네집&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;요구사항&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;결과값을 json 형태로 반환하기&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;관련 라이브러리&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(159, 211, 49); border-right-color: rgb(159, 211, 49); border-bottom-color: rgb(159, 211, 49); border-left-color: rgb(159, 211, 49); background-color: rgb(231, 253, 181); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
- ezmorph-1.0.6.jar&lt;/div&gt;
&lt;div&gt;- json-lib-2.3-jdk15.jar&lt;/div&gt;
&lt;div&gt;- commons-lang.jar&lt;/div&gt;
&lt;div&gt;- commons-logging-1.1.jar&lt;/div&gt;
&lt;div&gt;- commons-collections-3.2.jar&lt;/div&gt;
&lt;div&gt;- commons-beanutils-1.8.0.jar&lt;/div&gt;
&lt;div&gt;- commons-beanutils-bean-collections-1.8.0.jar&lt;/div&gt;
&lt;div&gt;- commons-beanutils-core-1.8.0.jar&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;테스트에 앞서 dto 생성&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(159, 211, 49); border-right-color: rgb(159, 211, 49); border-bottom-color: rgb(159, 211, 49); border-left-color: rgb(159, 211, 49); background-color: rgb(231, 253, 181); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
package test.dto;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
import java.math.BigDecimal;&lt;/div&gt;
&lt;div&gt;import java.util.Date;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
public class A {&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;private String id;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private int age;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private Date credate;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private BigDecimal iq;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public A(String id, int age, Date credate, BigDecimal iq){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.id=id;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.age=age;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.credate=credate;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.iq=iq;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public String getId() {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return id;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setId(String id) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.id = id;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public int getAge() {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return age;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setAge(int age) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.age = age;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public Date getCredate() {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return credate;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setCredate(Date credate) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.credate = credate;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public BigDecimal getIq() {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return iq;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setIq(BigDecimal iq) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.iq = iq;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;실재 처리 할 util 클래스&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;public class JsonUtil {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public static String getJsonString(Object obj){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(obj == null) return null;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return JSONObject.fromObject(obj).toString();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;테스트 클래스&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
public class JsonTest {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// object test&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(JsonUtil.getJsonString(getTestData()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : {&quot;age&quot;:20,&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:46,&quot;month&quot;:6,&quot;seconds&quot;:19,&quot;time&quot;:1280123179718,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;private static Object getTestData(){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A a = new A(&quot;kkaok&quot;, 20, new Date(), new BigDecimal(2010));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return a;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;1. 기본 객체 테스트&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;result :&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(193, 193, 193); border-right-color: rgb(193, 193, 193); border-bottom-color: rgb(193, 193, 193); border-left-color: rgb(193, 193, 193); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
{&quot;age&quot;:20,&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:46,&quot;month&quot;:6,&quot;seconds&quot;:19,&quot;time&quot;:1280123179718,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010}&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;2. java.util.Date type인 경우 conversion하기&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;기본적인 테스트는 성공했는데 결과 값 중에 날짜가 영 맘에 안든다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;날짜를 바꿔보기 (&quot;yyyy-MM-dd HH:mm:ss.SSS&quot;)&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
JsonValueProcessor로 java.util.Date 타입인 경우 &quot;yyyy-MM-dd HH:mm:ss.SSS&quot; 형태로 결과를 보여 주도록 한다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;package test.support;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
import java.text.DateFormat;&lt;/div&gt;
&lt;div&gt;import java.text.SimpleDateFormat;&lt;/div&gt;
&lt;div&gt;import java.util.Locale;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
import net.sf.json.JsonConfig;&lt;/div&gt;
&lt;div&gt;import net.sf.json.processors.JsonValueProcessor;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;public class JavaUtilDateJsonValueProcessor implements JsonValueProcessor {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private final DateFormat defaultDateFormat;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public JavaUtilDateJsonValueProcessor(){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;defaultDateFormat = new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss.SSS&quot;, Locale.KOREA);&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;@Override&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public Object processArrayValue(Object paramObject,&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonConfig paramJsonConfig) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(paramObject == null) return null;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return defaultDateFormat.format(paramObject);&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;@Override&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public Object processObjectValue(String paramString, Object paramObject,&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonConfig paramJsonConfig) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return processArrayValue(paramObject, paramJsonConfig);&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
util에 JsonConfig에 추가해 준다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;public class JsonUtil {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public static String getJsonString(Object obj){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(obj == null) return null;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonValueProcessor beanProcessor = new JavaUtilDateJsonValueProcessor();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonConfig jsonConfig = new JsonConfig();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;jsonConfig.registerJsonValueProcessor(java.util.Date.class, beanProcessor); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return JSONObject.fromObject(obj, jsonConfig).toString();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;테스트 결과&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(193, 193, 193); border-right-color: rgb(193, 193, 193); border-bottom-color: rgb(193, 193, 193); border-left-color: rgb(193, 193, 193); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
{&quot;age&quot;:20,&quot;credate&quot;:&quot;2010-07-26 14:46:20.406&quot;,&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;괜찮게 나온다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;3. 값이 null일때는 어떻게 나올까?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// object test&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(JsonUtil.getJsonString(getTestData()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : {&quot;age&quot;:20,&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:46,&quot;month&quot;:6,&quot;seconds&quot;:19,&quot;time&quot;:1280123179718,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// 날짜 꼬라지 하고는 바꾸자&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(JsonUtil.getJsonString2(getTestData()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : {&quot;age&quot;:20,&quot;credate&quot;:&quot;2010-01-25 17:30:19.165&quot;,&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010}&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// null로 대충 채우고 확인&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(JsonUtil.getJsonString2(getTestData2()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : {&quot;age&quot;:20,&quot;credate&quot;:null,&quot;id&quot;:&quot;&quot;,&quot;iq&quot;:0}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private static Object getTestData2(){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A a = new A(null, 20, null, null);&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return a;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;결과 :&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(193, 193, 193); border-right-color: rgb(193, 193, 193); border-bottom-color: rgb(193, 193, 193); border-left-color: rgb(193, 193, 193); background-color: rgb(238, 238, 238); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
{&quot;age&quot;:20,&quot;credate&quot;:null,&quot;id&quot;:&quot;&quot;,&quot;iq&quot;:0}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
없으면 없는대로 나온다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;4. 객체 안에 객체를 필드로 가지고 있는 경우는 어떨까?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;dto 추가&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
package test.dto;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
public class B {&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public B(A a, String bid) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;super();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.a = a;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.bid = bid;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private A a;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private String bid;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public A getA() {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return a;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setA(A a) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.a = a;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public String getBid() {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return bid;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public void setBid(String bid) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.bid = bid;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
테스트&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// 객체를 필드로 가지고 있는 객체 테스트1&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(JsonUtil.getJsonString2(getTestData3()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : {&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:&quot;2010-07-26 14:57:04.468&quot;,&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private static Object getTestData3(){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;A a = new A(&quot;kkaok&quot;, 20, new Date(), new BigDecimal(2010));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B b = new B(a, &quot;aaaa&quot;);&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return b;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;span style=&quot;font-size: 12pt; &quot;&gt;&lt;b&gt;5. Map인 경우는?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// map test&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(JsonUtil.getJsonString2(getTestData5()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : {&quot;credate&quot;:&quot;2010-07-26 14:57:04.468&quot;,&quot;test&quot;:{&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:&quot;2010-07-26 14:57:04.468&quot;,&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;},&quot;name&quot;:&quot;kkaok&quot;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private static Object getTestData5(){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Map map = new HashMap();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;map.put(&quot;test&quot;, getTestData3());&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;map.put(&quot;name&quot;, &quot;kkaok&quot;);&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;map.put(&quot;credate&quot;, new Date());&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return map;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;6. list 테스트.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
util에 JSONArray 추가&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
public class JsonUtil {&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public static String getJsonString(Object obj){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(obj == null) return null;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return JSONObject.fromObject(obj).toString();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public static String getJsonString2(Object obj){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(obj == null) return null;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonValueProcessor beanProcessor = new JavaUtilDateJsonValueProcessor();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JsonConfig jsonConfig = new JsonConfig();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;jsonConfig.registerJsonValueProcessor(java.util.Date.class, beanProcessor); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return JSONObject.fromObject(obj, jsonConfig).toString();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public static String getJSONArrayString(Object objList){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if(objList == null) return null;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;JSONArray jsonArray = JSONArray.fromObject(objList);&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return jsonArray.toString();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;테스트&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;&lt;div&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// list test&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(&quot;6. &quot;+JsonUtil.getJSONArrayString(getTestData6()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : [{&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:57,&quot;month&quot;:6,&quot;seconds&quot;:4,&quot;time&quot;:1280123824468,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;test&quot;:{&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:57,&quot;month&quot;:6,&quot;seconds&quot;:4,&quot;time&quot;:1280123824468,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;},&quot;name&quot;:&quot;kkaok&quot;},{&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:57,&quot;month&quot;:6,&quot;seconds&quot;:4,&quot;time&quot;:1280123824468,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;}]&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private static Object getTestData6(){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List list = new ArrayList();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;list.add(getTestData5());&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;list.add(getTestData3());&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return list;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;List안에 객체랑 Map이랑 마구 섞어 놓아도 잘 된다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;&lt;b&gt;7. Map안에 List는 잘 처리 될까?&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// map 안에 list test&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(&quot;7. &quot;+JsonUtil.getJsonString2(getTestData7()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : {&quot;credate&quot;:&quot;2010-07-26 14:57:04.468&quot;,&quot;test&quot;:[{&quot;credate&quot;:&quot;2010-07-26 14:57:04.468&quot;,&quot;test&quot;:{&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:&quot;2010-07-26 14:57:04.468&quot;,&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;},&quot;name&quot;:&quot;kkaok&quot;},{&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:&quot;2010-07-26 14:57:04.468&quot;,&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;}],&quot;name&quot;:&quot;kkaok&quot;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private static Object getTestData7(){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Map map = new HashMap();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;map.put(&quot;test&quot;, getTestData6());&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;map.put(&quot;name&quot;, &quot;kkaok&quot;);&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;map.put(&quot;credate&quot;, new Date());&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return map;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
잘 된다. ^^&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: 12pt; &quot;&gt;8. List안에 List 담기&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class=&quot;txc-textbox&quot; style=&quot;border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: rgb(243, 197, 52); border-right-color: rgb(243, 197, 52); border-bottom-color: rgb(243, 197, 52); border-left-color: rgb(243, 197, 52); background-color: rgb(254, 254, 184); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;public static void main(String[] args) {&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// list 안에 list test&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.out.println(&quot;8. &quot;+JsonUtil.getJSONArrayString(getTestData8()));&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// result : [[{&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:57,&quot;month&quot;:6,&quot;seconds&quot;:4,&quot;time&quot;:1280123824468,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;test&quot;:{&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:57,&quot;month&quot;:6,&quot;seconds&quot;:4,&quot;time&quot;:1280123824468,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;},&quot;name&quot;:&quot;kkaok&quot;},{&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:57,&quot;month&quot;:6,&quot;seconds&quot;:4,&quot;time&quot;:1280123824468,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;}],{&quot;a&quot;:{&quot;age&quot;:20,&quot;credate&quot;:{&quot;date&quot;:26,&quot;day&quot;:1,&quot;hours&quot;:14,&quot;minutes&quot;:57,&quot;month&quot;:6,&quot;seconds&quot;:4,&quot;time&quot;:1280123824468,&quot;timezoneOffset&quot;:-540,&quot;year&quot;:110},&quot;id&quot;:&quot;kkaok&quot;,&quot;iq&quot;:2010},&quot;bid&quot;:&quot;aaaa&quot;}]&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;private static Object getTestData8(){&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;List list = new ArrayList();&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;list.add(getTestData6());&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;list.add(getTestData3());&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return list;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;파싱할때 객체가 isArray 면&amp;nbsp;&lt;b&gt;&lt;u&gt;JSONArray를 이용&lt;/u&gt;&lt;/b&gt;하고 그외 나머지는&amp;nbsp;&lt;b&gt;&lt;u&gt;JSONObject를 이용&lt;/u&gt;&lt;/b&gt;하면 쉽게 변환이 된다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;그외 conversion이 필요한 경우 JsonConfig에 등록해서 처리하면 된다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;값을 처리하는 인터페이스는 JsonValueProcessor 이용하고 Bean을 처리하는 인터페이스는 JsonBeanProcessor 이용하면 된다.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;그외 인터페이스 참고&amp;nbsp;&lt;/div&gt;
&lt;/span&gt;&lt;div class=&quot;entry-ccl&quot; style=&quot;clear: both; text-align: right; margin-bottom: 10px&quot;&gt;
	&lt;a href=&quot;http://creativecommons.org/licenses/by/4.0/deed.ko&quot; target=&quot;_blank&quot; style=&quot;text-decoration: none&quot;&gt;
	&lt;img id=&quot;ccl-icon-44-0&quot; class=&quot;entry-ccl-by&quot; src=&quot;//i1.daumcdn.net/cfs.tistory/resource/4191/static/admin/editor/ccl_black01.png&quot; alt=&quot;저작자 표시&quot;/&gt;
	&lt;!--
	&lt;rdf:RDF xmlns=&quot;http://web.resource.org/cc/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
		&lt;Work rdf:about=&quot;&quot;&gt;
			&lt;license rdf:resource=&quot;http://creativecommons.org/licenses/by-fr/2.0/kr/&quot; /&gt;
		&lt;/Work&gt;
		&lt;License rdf:about=&quot;http://creativecommons.org/licenses/by-fr/&quot;&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Attribution&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/DerivativeWorks&quot;/&gt;
		&lt;/License&gt;
	&lt;/rdf:RDF&gt;
	--&gt;
	&lt;/a&gt;
&lt;/div&gt;
</description>
<category>자바</category>
<category>java</category>
<category>JSON</category>
<category>JsonValueProcessor</category>
<author>양군이당</author>
<guid>http://yanggoony.tistory.com/44</guid>
<comments>http://yanggoony.tistory.com/44#entry44comment</comments>
<pubDate>Sun, 23 May 2010 04:00:45 +0900</pubDate>
</item>
<item>
<title>정규식을 이용한 다양한 예제</title>
<link>http://yanggoony.tistory.com/42</link>
<description>&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); font-family: Gulim; line-height: normal; font-size: medium; &quot;&gt;&lt;div style=&quot;margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; background-color: rgb(255, 255, 255); font-family: Verdana, Arial, Helvetica; font-size: 11pt; &quot;&gt;
&lt;h1 style=&quot;font-family: Verdana, Arial; &quot;&gt;&lt;span style=&quot;font-size: 10pt; &quot;&gt;출처 :&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica; font-weight: normal; font-size: 15px; &quot;&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#Ex_StripHTML&quot;&gt;&lt;span style=&quot;font-size: 10pt; &quot;&gt;http://www.java2go.net/java/java_regex.html#Ex_StripHTML&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/h1&gt;&lt;h1 style=&quot;font-family: Verdana, Arial; &quot;&gt;Regular Expressions in Java&lt;/h1&gt;&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;5&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td align=&quot;right&quot;&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;&lt;span id=&quot;btn_big&quot;&gt;코드 크게&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div id=&quot;contents&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#Java_Regex_Basics&quot;&gt;자바 정규표현식&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#Java_Regex_Samples&quot;&gt;자바 정규표현식 사용 예제&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#Java_Regex_References&quot;&gt;Java Regex References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;p class=&quot;pagebreak&quot; style=&quot;page-break-before: always; &quot;&gt;&lt;a name=&quot;Java_Regex_Basics&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 style=&quot;font-family: Verdana, Arial; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: rgb(119, 119, 119); &quot;&gt;자바 정규표현식&lt;/h2&gt;&lt;p&gt;자바의 정규표현식은 J2SE 1.4 부터 지원되지 시작했습니다. 관련된 주요 클래스들는 java.util.regex 팩키지에 있습니다.&lt;/p&gt;
&lt;a name=&quot;Pattern&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Pattern 클래스&lt;/h3&gt;&lt;p&gt;Pattern 객체는 Perl 문법과 비슷한 형태로 정의된 정규표현식을 나타냅니다. 문자열로 정의한 정규표현식은 사용되기 전에 반드시 Pattern 클래스의 인스턴스로 컴파일되어야 합니다. 컴파일된 패턴은 Matcher 객체를 만드는 데 사용되며, Matcher 객체는 임의의 입력 문자열이 패턴에 부합되는 지 여부를 판가름하는 기능을 담당하합니다. 또한 Pattern 객체들은 비상태유지 객체들이기 때문에 여러 개의 Matcher 객체들이 공유할 수 있습니다.&lt;/p&gt;
&lt;a name=&quot;Matcher&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Matcher 클래스&lt;/h3&gt;&lt;p&gt;Matcher 객체는 특정한 문자열이 주어진 패턴과 일치하는가를 알아보는데 이용됩니다. Matcher 클래스의 입력값으로는 CharSequence라는 새로운 인터페이스가 사용되는데 이를 통해 다양한 형태의 입력 데이터로부터 문자 단위의 매칭 기능을 지원 받을 수 있습니다. 기본적으로 제공되는 CharSequence 객체들은 CharBuffer, String, StringBuffer 클래스가 있습니다.&lt;/p&gt;
&lt;p&gt;Matcher 객체는 Pattern 객체의 matcher 메소드를 통해 얻어진다. Matcher 객체가 일단 만들어지면 주로 세 가지 목적으로 사용됩다.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;주어진 문자열 전체가 특정 패턴과 일치하는 가를 판단(matches).&lt;/li&gt;
&lt;li&gt;주어진 문자열이 특정 패턴으로 시작하는가를 판단(lookingAt).&lt;/li&gt;
&lt;li&gt;주어진 문자열에서 특정 패턴을 찾아낸다(find).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;이들 메소드는 성공 시 true를 실패 시 false 를 반환합니다.&lt;/p&gt;
&lt;p&gt;또한 특정 문자열을 찾아 새로운 문자열로 교체하는 기능도 제공됩니다. appendRepalcement 메소드는 일치하는 패턴이 나타날 때까지의 모든 문자들을 버퍼로 옮기고 찾아진 문자열 대신 교체 문자열로 채워 넣습니다. 또한 appendTail 메소드는 캐릭터 시퀀스의 현재 위치 이후의 문자들을 버퍼에 복사해 넣습니다. 다음 절에 나오는 예제 코드를 참고하도록 합시다.&lt;/p&gt;
&lt;a name=&quot;CharSequence&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;CharSequence 인터페이스&lt;/h3&gt;&lt;p&gt;CharSequence 인터페이스는 다양한 형태의 캐릭터 시퀀스에 대해 일관적인 접근 방법을 제공하기 위해 새로 생겨났으며, java.lang 패키지에 존재합니다. 기본적으로 String, StringBuffer, CharBuffer 클래스가 이를 구현하고 있으므로 적절한 것을 골라 사용하면 되며, 인터페이스가 간단하므로 필요하면 직접 이를 구현해 새로 하나 만들어도 됩니다.&lt;/p&gt;
&lt;br /&gt;
&lt;p class=&quot;pagebreak&quot; style=&quot;page-break-before: always; &quot;&gt;&lt;a name=&quot;Java_Regex_Samples&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 style=&quot;font-family: Verdana, Arial; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: rgb(119, 119, 119); &quot;&gt;자바 정규표현식 사용 예제&lt;/h2&gt;&lt;a name=&quot;Ex_BasicUsage&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;기본 사용 예제&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;소스&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_src_01&quot;&gt;
&lt;div class=&quot;ex_src&quot; style=&quot;background-color: rgb(221, 221, 221); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(119, 119, 119); border-right-color: rgb(119, 119, 119); border-bottom-color: rgb(119, 119, 119); border-left-color: rgb(119, 119, 119); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 정규표현식 기본 사용 예제 
 * 
 * @author   Sehwan Noh &amp;lt;sehnoh at java2go.net&amp;gt;
 * @version  1.0 - 2006. 08. 22
 * @since    JDK 1.4
 */
public class RegExTest01 {

    public static void main(String[] args) {

        Pattern p = Pattern.compile(&quot;a*b&quot;);
        Matcher m = p.matcher(&quot;aaaaab&quot;);
        boolean b = m.matches();
        
        if (b) {
            System.out.println(&quot;match&quot;);
        } else {
            System.out.println(&quot;not match&quot;);
        }
    }
}&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;결과&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_out_01&quot;&gt;
&lt;div class=&quot;ex_out&quot; style=&quot;background-color: rgb(204, 221, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 119, 136); border-right-color: rgb(102, 119, 136); border-bottom-color: rgb(102, 119, 136); border-left-color: rgb(102, 119, 136); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;match&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a name=&quot;Ex_ReplaceString&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;문자열 치환하기&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;소스&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_src_02&quot;&gt;
&lt;div class=&quot;ex_src&quot; style=&quot;background-color: rgb(221, 221, 221); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(119, 119, 119); border-right-color: rgb(119, 119, 119); border-bottom-color: rgb(119, 119, 119); border-left-color: rgb(119, 119, 119); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 문자열 치환 예제
 * 
 * @author   Sehwan Noh &amp;lt;sehnoh at java2go.net&amp;gt;
 * @version  1.0 - 2006. 08. 22
 * @since    JDK 1.4
 */
public class RegExTest02 {

    public static void main(String[] args) {

        Pattern p = Pattern.compile(&quot;cat&quot;);
        Matcher m = p.matcher(&quot;one cat two cats in the yard&quot;);
        
        StringBuffer sb = new StringBuffer();
        while (m.find()) {
            m.appendReplacement(sb, &quot;dog&quot;);
        }
        m.appendTail(sb);
        System.out.println(sb.toString());
        
        // or
        //String str = m.replaceAll(&quot;dog&quot;);
        //System.out.println(str);
    }
}&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;결과&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_out_02&quot;&gt;
&lt;div class=&quot;ex_out&quot; style=&quot;background-color: rgb(204, 221, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 119, 136); border-right-color: rgb(102, 119, 136); border-bottom-color: rgb(102, 119, 136); border-left-color: rgb(102, 119, 136); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;one dog two dogs in the yard&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a name=&quot;Ex_IsValidEmail&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;이메일주소 유효검사&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;소스&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_src_03&quot;&gt;
&lt;div class=&quot;ex_src&quot; style=&quot;background-color: rgb(221, 221, 221); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(119, 119, 119); border-right-color: rgb(119, 119, 119); border-bottom-color: rgb(119, 119, 119); border-left-color: rgb(119, 119, 119); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 이메일주소 유효검사
 * 
 * @author   Sehwan Noh &amp;lt;sehnoh at java2go.net&amp;gt;
 * @version  1.0 - 2006. 08. 22
 * @since    JDK 1.4
 */
public class RegExTest03 {
    
    public static boolean isValidEmail(String email) {
        Pattern p = Pattern.compile(&quot;^(?:\\w+\\.?)*\\w+@(?:\\w+\\.)+\\w+$&quot;);
        Matcher m = p.matcher(email);
        return m.matches();
    }

    public static void main(String[] args) {
        
        String[] emails = { &quot;test@abc.com&quot;, &quot;a@.com&quot;, &quot;abc@mydomain&quot; };
        
        for (int i = 0; i &amp;lt; emails.length; i ++) {
            if (isValidEmail(emails[i])) {
                System.out.println(emails[i]);
            }
        }
    }
}&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;결과&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_out_03&quot;&gt;
&lt;div class=&quot;ex_out&quot; style=&quot;background-color: rgb(204, 221, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 119, 136); border-right-color: rgb(102, 119, 136); border-bottom-color: rgb(102, 119, 136); border-left-color: rgb(102, 119, 136); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;test@abc.com&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a name=&quot;Ex_StripHTML&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;HTML 태그 제거&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;소스&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_src_04&quot;&gt;
&lt;div class=&quot;ex_src&quot; style=&quot;background-color: rgb(221, 221, 221); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(119, 119, 119); border-right-color: rgb(119, 119, 119); border-bottom-color: rgb(119, 119, 119); border-left-color: rgb(119, 119, 119); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * HTML 태그 제거
 * 
 * @author   Sehwan Noh &amp;lt;sehnoh at java2go.net&amp;gt;
 * @version  1.0 - 2006. 08. 22
 * @since    JDK 1.4
 */
public class RegExTest04 {

    public static String stripHTML(String htmlStr) {
        Pattern p = Pattern.compile(&quot;&amp;lt;(?:.|\\s)*?&amp;gt;&quot;);
        Matcher m = p.matcher(htmlStr);
        return m.replaceAll(&quot;&quot;);
    }
    
    public static void main(String[] args) {
        String htmlStr = &quot;&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Java2go.net&amp;lt;/h1&amp;gt;&quot;
            + &quot; &amp;lt;p&amp;gt;Sehwan@Noh's Personal Workspace...&amp;lt;/p&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&quot;;
        System.out.println(stripHTML(htmlStr));        
    }
}&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;결과&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_out_04&quot;&gt;
&lt;div class=&quot;ex_out&quot; style=&quot;background-color: rgb(204, 221, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 119, 136); border-right-color: rgb(102, 119, 136); border-bottom-color: rgb(102, 119, 136); border-left-color: rgb(102, 119, 136); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;Java2go.net Sehwan@Noh's Personal Workspace...&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a name=&quot;Ex_LinkedText&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;HTML 링크 만들기&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;소스&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_src_05&quot;&gt;
&lt;div class=&quot;ex_src&quot; style=&quot;background-color: rgb(221, 221, 221); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(119, 119, 119); border-right-color: rgb(119, 119, 119); border-bottom-color: rgb(119, 119, 119); border-left-color: rgb(119, 119, 119); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * HTML 링크 만들기
 * 
 * @author   Sehwan Noh &amp;lt;sehnoh at java2go.net&amp;gt;
 * @version  1.0 - 2006. 08. 22
 * @since    JDK 1.4
 */
public class RegExTest05 {

    public static String linkedText(String sText) {
        Pattern p = Pattern.compile(&quot;(http|https|ftp)://[^\\s^\\.]+(\\.[^\\s^\\.]+)*&quot;);
        Matcher m = p.matcher(sText);

        StringBuffer sb = new StringBuffer();
        while (m.find()) {
            m.appendReplacement(sb, &quot;&amp;lt;a href='&quot; + m.group()+&quot;'&amp;gt;&quot; + m.group() + &quot;&amp;lt;/a&amp;gt;&quot;);
        }
        m.appendTail(sb);

        return sb.toString();
    }    
        
    public static void main(String[] args) {        
        String strText = &quot;My homepage URL is http://www.java2go.net/home/index.html.&quot;;
        System.out.println(linkedText(strText));
    }
}
&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;결과&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_out_05&quot;&gt;
&lt;div class=&quot;ex_out&quot; style=&quot;background-color: rgb(204, 221, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 119, 136); border-right-color: rgb(102, 119, 136); border-bottom-color: rgb(102, 119, 136); border-left-color: rgb(102, 119, 136); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;My homepage URL is &amp;lt;a href='http://www.java2go.net/index.html'&amp;gt;http://www.java2go.net/index.html&amp;lt;/a&amp;gt;.&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;a name=&quot;Ex_FilterText&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;금지어 필터링하기&lt;/h3&gt;&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;소스&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_src_06&quot;&gt;
&lt;div class=&quot;ex_src&quot; style=&quot;background-color: rgb(221, 221, 221); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(119, 119, 119); border-right-color: rgb(119, 119, 119); border-bottom-color: rgb(119, 119, 119); border-left-color: rgb(119, 119, 119); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 금지어 필터링하기
 * 
 * @author   Sehwan Noh &amp;lt;sehnoh at java2go.net&amp;gt;
 * @version  1.0 - 2006. 08. 22
 * @since    JDK 1.4
 */
public class RegExTest06 {
    
    public static String filterText(String sText) {
        Pattern p = Pattern.compile(&quot;fuck|shit|개새끼&quot;, Pattern.CASE_INSENSITIVE);
        Matcher m = p.matcher(sText);

        StringBuffer sb = new StringBuffer();
        while (m.find()) {
            //System.out.println(m.group());
            m.appendReplacement(sb, maskWord(m.group()));
        }
        m.appendTail(sb);
        
        //System.out.println(sb.toString());
        return sb.toString();
    }
    
    public static String maskWord(String word) {
        StringBuffer buff = new StringBuffer();
        char[] ch = word.toCharArray();
        for (int i = 0; i &amp;lt; ch.length; i++) {
            if (i &amp;lt; 1) {
                buff.append(ch[i]);
            } else {
                buff.append(&quot;*&quot;);
            }
        }
        return buff.toString();
    }
    
    public static void main(String[] args) {
        String sText = &quot;Shit! Read the fucking manual. 개새끼야.&quot;;        
        System.out.println(filterText(sText));
    }
}&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.java2go.net/java/java_regex.html#&quot;&gt;결과&lt;/a&gt;&lt;/p&gt;
&lt;div id=&quot;ex_out_06&quot;&gt;
&lt;div class=&quot;ex_out&quot; style=&quot;background-color: rgb(204, 221, 238); border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(102, 119, 136); border-right-color: rgb(102, 119, 136); border-bottom-color: rgb(102, 119, 136); border-left-color: rgb(102, 119, 136); padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; &quot;&gt;
&lt;table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;td&gt;&lt;pre class=&quot;code&quot; style=&quot;font-family: 'Courier New', Courier, monospace; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; font-size: 9pt; &quot;&gt;S***! Read the f***ing manual. 개**야.&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;p class=&quot;pagebreak&quot; style=&quot;page-break-before: always; &quot;&gt;&lt;a name=&quot;Java_Regex_References&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 style=&quot;font-family: Verdana, Arial; border-bottom-style: solid; border-bottom-width: 1px; border-bottom-color: rgb(119, 119, 119); &quot;&gt;Java Regex References&lt;/h2&gt;&lt;p&gt;A regular expression, specified as a string, must first be compiled into an instance of this class. The resulting pattern can then be used to create a Matcher object that can match arbitrary character sequences against the regular expression. All of the state involved in performing a match resides in the matcher, so many matchers can share the same pattern.&lt;/p&gt;
&lt;p&gt;A typical invocation sequence is thus&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt; Pattern p = Pattern.compile(&quot;a*b&quot;);
 Matcher m = p.matcher(&quot;aaaaab&quot;);
 boolean b = m.matches();&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;A matches method is defined by this class as a convenience for when a regular expression is used just once. This method compiles an expression and matches an input sequence against it in a single invocation. The statement&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt; boolean b = Pattern.matches(&quot;a*b&quot;, &quot;aaaaab&quot;);&lt;/pre&gt;&lt;/blockquote&gt;is equivalent to the three statements above, though for repeated matches it is less efficient since it does not allow the compiled pattern to be reused.&lt;p&gt;Instances of this class are immutable and are safe for use by multiple concurrent threads. Instances of the Matcher class are not safe for such use.&lt;/p&gt;
&lt;a name=&quot;SummaryOfRegExConstructs&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Summary of regular-expression constructs&lt;/h3&gt;&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;1&quot; summary=&quot;Regular expression constructs, and what they match&quot; border=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;construct&quot; align=&quot;left&quot; bgcolor=&quot;#ccccff&quot;&gt;Construct&lt;/th&gt;&lt;th id=&quot;matches&quot; align=&quot;left&quot; bgcolor=&quot;#ccccff&quot;&gt;Matches&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;characters&quot; colspan=&quot;2&quot;&gt;Characters&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;&lt;em&gt;x&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The character&amp;nbsp;&lt;em&gt;x&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\\&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The backslash character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\0&lt;em&gt;n&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The character with octal value 0&lt;em&gt;n&lt;/em&gt;&amp;nbsp;(0&amp;nbsp;&amp;lt;=&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;&amp;lt;=&amp;nbsp;7)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\0&lt;em&gt;nn&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The character with octal value 0&lt;em&gt;nn&lt;/em&gt;&amp;nbsp;(0&amp;nbsp;&amp;lt;=&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;&amp;lt;=&amp;nbsp;7)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\0&lt;em&gt;mnn&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The character with octal value 0&lt;em&gt;mnn&lt;/em&gt;&amp;nbsp;(0&amp;nbsp;&amp;lt;=&amp;nbsp;&lt;em&gt;m&lt;/em&gt;&amp;nbsp;&amp;lt;=&amp;nbsp;3, 0&amp;nbsp;&amp;lt;=&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;&amp;lt;=&amp;nbsp;7)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\x&lt;em&gt;hh&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The character with hexadecimal&amp;nbsp;value&amp;nbsp;0x&lt;em&gt;hh&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\u&lt;em&gt;hhhh&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The character with hexadecimal&amp;nbsp;value&amp;nbsp;0x&lt;em&gt;hhhh&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;matches&quot;&gt;\t&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The tab character ('\u0009')&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\n&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The newline (line feed) character ('\u000A')&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\r&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The carriage-return character ('\u000D')&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\f&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The form-feed character ('\u000C')&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\a&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The alert (bell) character ('\u0007')&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\e&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The escape character ('\u001B')&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct characters&quot;&gt;\c&lt;em&gt;x&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The control character corresponding to&amp;nbsp;&lt;em&gt;x&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;classes&quot; colspan=&quot;2&quot;&gt;Character classes&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct classes&quot;&gt;[abc]&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;a, b, or c (simple class)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct classes&quot;&gt;[^abc]&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Any character except a, b, or c (negation)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct classes&quot;&gt;[a-zA-Z]&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;a through z or A through Z, inclusive (range)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct classes&quot;&gt;[a-d[m-p]]&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;a through d, or m through p: [a-dm-p] (union)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct classes&quot;&gt;[a-z&amp;amp;&amp;amp;[def]]&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;d, e, or f (intersection)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct classes&quot;&gt;[a-z&amp;amp;&amp;amp;[^bc]]&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;a through z, except for b and c: [ad-z] (subtraction)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct classes&quot;&gt;[a-z&amp;amp;&amp;amp;[^m-p]]&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;a through z, and not m through p: [a-lq-z](subtraction)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;predef&quot; colspan=&quot;2&quot;&gt;Predefined character classes&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct predef&quot;&gt;.&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Any character (may or may not match line terminators)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct predef&quot;&gt;\d&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A digit: [0-9]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct predef&quot;&gt;\D&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A non-digit: [^0-9]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct predef&quot;&gt;\s&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A whitespace character: [ \t\n\x0B\f\r]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct predef&quot;&gt;\S&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A non-whitespace character: [^\s]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct predef&quot;&gt;\w&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A word character: [a-zA-Z_0-9]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct predef&quot;&gt;\W&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A non-word character: [^\w]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;posix&quot; colspan=&quot;2&quot;&gt;POSIX character classes (US-ASCII only)&lt;strong&gt;&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Lower}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A lower-case alphabetic character: [a-z]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Upper}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;An upper-case alphabetic character:[A-Z]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{ASCII}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;All ASCII:[\x00-\x7F]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Alpha}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;An alphabetic character:[\p{Lower}\p{Upper}]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Digit}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A decimal digit: [0-9]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Alnum}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;An alphanumeric character:[\p{Alpha}\p{Digit}]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Punct}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Punctuation: One of !&quot;#$%&amp;amp;'()*+,-./:;&amp;lt;=&amp;gt;?@[\]^_`{|}~&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Graph}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A visible character: [\p{Alnum}\p{Punct}]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Print}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A printable character: [\p{Graph}\x20]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Blank}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A space or a tab: [ \t]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Cntrl}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A control character: [\x00-\x1F\x7F]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{XDigit}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A hexadecimal digit: [0-9a-fA-F]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct posix&quot;&gt;\p{Space}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A whitespace character: [ \t\n\x0B\f\r]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th colspan=&quot;2&quot;&gt;java.lang.Character classes (simple java character type)&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot;&gt;\p{javaLowerCase}&lt;/td&gt;
&lt;td&gt;Equivalent to java.lang.Character.isLowerCase()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot;&gt;\p{javaUpperCase}&lt;/td&gt;
&lt;td&gt;Equivalent to java.lang.Character.isUpperCase()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot;&gt;\p{javaWhitespace}&lt;/td&gt;
&lt;td&gt;Equivalent to java.lang.Character.isWhitespace()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot;&gt;\p{javaMirrored}&lt;/td&gt;
&lt;td&gt;Equivalent to java.lang.Character.isMirrored()&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;unicode&quot; colspan=&quot;2&quot;&gt;Classes for Unicode blocks and categories&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct unicode&quot;&gt;\p{InGreek}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A character in the Greek&amp;nbsp;block (simple block)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct unicode&quot;&gt;\p{Lu}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;An uppercase letter (simple category)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct unicode&quot;&gt;\p{Sc}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A currency symbol&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct unicode&quot;&gt;\P{InGreek}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Any character except one in the Greek block (negation)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct unicode&quot;&gt;[\p{L}&amp;amp;&amp;amp;[^\p{Lu}]]&amp;nbsp;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Any letter except an uppercase letter (subtraction)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;bounds&quot; colspan=&quot;2&quot;&gt;Boundary matchers&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct bounds&quot;&gt;^&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The beginning of a line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct bounds&quot;&gt;$&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The end of a line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct bounds&quot;&gt;\b&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A word boundary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct bounds&quot;&gt;\B&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;A non-word boundary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct bounds&quot;&gt;\A&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The beginning of the input&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct bounds&quot;&gt;\G&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The end of the previous match&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct bounds&quot;&gt;\Z&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The end of the input but for the final terminator, if&amp;nbsp;any&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct bounds&quot;&gt;\z&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;The end of the input&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;greedy&quot; colspan=&quot;2&quot;&gt;Greedy quantifiers&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct greedy&quot;&gt;&lt;em&gt;X&lt;/em&gt;?&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, once or not at all&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct greedy&quot;&gt;&lt;em&gt;X&lt;/em&gt;*&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, zero or more times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct greedy&quot;&gt;&lt;em&gt;X&lt;/em&gt;+&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, one or more times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct greedy&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, exactly&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct greedy&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;,}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, at least&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct greedy&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;,&lt;em&gt;m&lt;/em&gt;}&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, at least&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;but not more than&amp;nbsp;&lt;em&gt;m&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;reluc&quot; colspan=&quot;2&quot;&gt;Reluctant quantifiers&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct reluc&quot;&gt;&lt;em&gt;X&lt;/em&gt;??&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, once or not at all&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct reluc&quot;&gt;&lt;em&gt;X&lt;/em&gt;*?&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, zero or more times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct reluc&quot;&gt;&lt;em&gt;X&lt;/em&gt;+?&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, one or more times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct reluc&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;}?&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, exactly&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct reluc&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;,}?&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, at least&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct reluc&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;,&lt;em&gt;m&lt;/em&gt;}?&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, at least&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;but not more than&amp;nbsp;&lt;em&gt;m&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;poss&quot; colspan=&quot;2&quot;&gt;Possessive quantifiers&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct poss&quot;&gt;&lt;em&gt;X&lt;/em&gt;?+&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, once or not at all&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct poss&quot;&gt;&lt;em&gt;X&lt;/em&gt;*+&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, zero or more times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct poss&quot;&gt;&lt;em&gt;X&lt;/em&gt;++&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, one or more times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct poss&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;}+&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, exactly&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct poss&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;,}+&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, at least&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct poss&quot;&gt;&lt;em&gt;X&lt;/em&gt;{&lt;em&gt;n&lt;/em&gt;,&lt;em&gt;m&lt;/em&gt;}+&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, at least&amp;nbsp;&lt;em&gt;n&lt;/em&gt;&amp;nbsp;but not more than&amp;nbsp;&lt;em&gt;m&lt;/em&gt;&amp;nbsp;times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;logical&quot; colspan=&quot;2&quot;&gt;Logical operators&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct logical&quot;&gt;&lt;em&gt;XY&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;&amp;nbsp;followed by&amp;nbsp;&lt;em&gt;Y&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct logical&quot;&gt;&lt;em&gt;X&lt;/em&gt;|&lt;em&gt;Y&lt;/em&gt;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Either&amp;nbsp;&lt;em&gt;X&lt;/em&gt;&amp;nbsp;or&amp;nbsp;&lt;em&gt;Y&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct logical&quot;&gt;(&lt;em&gt;X&lt;/em&gt;)&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;X, as a capturing group&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;backref&quot; colspan=&quot;2&quot;&gt;Back references&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;bottom&quot; headers=&quot;construct backref&quot;&gt;\&lt;em&gt;n&lt;/em&gt;&lt;/td&gt;
&lt;td valign=&quot;bottom&quot; headers=&quot;matches&quot;&gt;Whatever the&amp;nbsp;&lt;em&gt;n&lt;/em&gt;th capturing group matched&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;quot&quot; colspan=&quot;2&quot;&gt;Quotation&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct quot&quot;&gt;\&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Nothing, but quotes the following character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct quot&quot;&gt;\Q&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Nothing, but quotes all characters until \E&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct quot&quot;&gt;\E&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Nothing, but ends quoting started by \Q&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;
&lt;tr align=&quot;left&quot;&gt;
&lt;th id=&quot;special&quot; colspan=&quot;2&quot;&gt;Special constructs (non-capturing)&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct special&quot;&gt;(?:&lt;em&gt;X&lt;/em&gt;)&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, as a non-capturing group&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct special&quot;&gt;(?idmsux-idmsux)&amp;nbsp;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;Nothing, but turns match flags on - off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct special&quot;&gt;(?idmsux-idmsux:&lt;em&gt;X&lt;/em&gt;)&amp;nbsp;&amp;nbsp;&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, as a non-capturing group with the given flags on - off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct special&quot;&gt;(?=&lt;em&gt;X&lt;/em&gt;)&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, via zero-width positive lookahead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct special&quot;&gt;(?!&lt;em&gt;X&lt;/em&gt;)&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, via zero-width negative lookahead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct special&quot;&gt;(?&amp;lt;=&lt;em&gt;X&lt;/em&gt;)&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, via zero-width positive lookbehind&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct special&quot;&gt;(?&amp;lt;!&lt;em&gt;X&lt;/em&gt;)&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, via zero-width negative lookbehind&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign=&quot;top&quot; headers=&quot;construct special&quot;&gt;(?&amp;gt;&lt;em&gt;X&lt;/em&gt;)&lt;/td&gt;
&lt;td headers=&quot;matches&quot;&gt;&lt;em&gt;X&lt;/em&gt;, as an independent, non-capturing group&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;a name=&quot;BackslashesEscapesQuoting&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Backslashes, escapes, and quoting&lt;/h3&gt;&lt;p&gt;The backslash character ('\') serves to introduce escaped constructs, as defined in the table above, as well as to quote characters that otherwise would be interpreted as unescaped constructs. Thus the expression \\ matches a single backslash and \{ matches a left brace.&lt;/p&gt;
&lt;p&gt;It is an error to use a backslash prior to any alphabetic character that does not denote an escaped construct; these are reserved for future extensions to the regular-expression language. A backslash may be used prior to a non-alphabetic character regardless of whether that character is part of an unescaped construct.&lt;/p&gt;
&lt;p&gt;Backslashes within string literals in Java source code are interpreted as required by the Java Language Specification as either Unicode escapes or other character escapes. It is therefore necessary to double backslashes in string literals that represent regular expressions to protect them from interpretation by the Java bytecode compiler. The string literal &quot;\b&quot;, for example, matches a single backspace character when interpreted as a regular expression, while &quot;\\b&quot; matches a word boundary. The string literal &quot;\(hello\)&quot; is illegal and leads to a compile-time error; in order to match the string (hello) the string literal &quot;\\(hello\\)&quot; must be used.&lt;/p&gt;
&lt;a name=&quot;CharacterClasses&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Character Classes&lt;/h3&gt;&lt;p&gt;Character classes may appear within other character classes, and may be composed by the union operator (implicit) and the intersection operator (&amp;amp;&amp;amp;). The union operator denotes a class that contains every character that is in at least one of its operand classes. The intersection operator denotes a class that contains every character that is in both of its operand classes.&lt;/p&gt;
&lt;p&gt;The precedence of character-class operators is as follows, from highest to lowest:&lt;/p&gt;
&lt;blockquote&gt;&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;1&quot; summary=&quot;Precedence of character class operators.&quot; border=&quot;0&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;th&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;Literal escape&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;\x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;Grouping&lt;/td&gt;
&lt;td&gt;[...]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;Range&lt;/td&gt;
&lt;td&gt;a-z&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;Union&lt;/td&gt;
&lt;td&gt;[a-e][i-u]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;Intersection&lt;/td&gt;
&lt;td&gt;[a-z&amp;amp;&amp;amp;[aeiou]]&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/blockquote&gt;&lt;p&gt;Note that a different set of metacharacters are in effect inside a character class than outside a character class. For instance, the regular expression . loses its special meaning inside a character class, while the expression - becomes a range forming metacharacter.&lt;/p&gt;
&lt;a name=&quot;LineTerminators&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Line terminators&lt;/h3&gt;&lt;p&gt;A&amp;nbsp;&lt;em&gt;line terminator&lt;/em&gt;&amp;nbsp;is a one- or two-character sequence that marks the end of a line of the input character sequence. The following are recognized as line terminators:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A newline (line feed) character&amp;nbsp;('\n'),&lt;/li&gt;
&lt;li&gt;A carriage-return character followed immediately by a newline character&amp;nbsp;(&quot;\r\n&quot;),&lt;/li&gt;
&lt;li&gt;A standalone carriage-return character&amp;nbsp;('\r'),&lt;/li&gt;
&lt;li&gt;A next-line character&amp;nbsp;('\u0085'),&lt;/li&gt;
&lt;li&gt;A line-separator character&amp;nbsp;('\u2028'), or&lt;/li&gt;
&lt;li&gt;A paragraph-separator character&amp;nbsp;('\u2029).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If UNIX_LINES mode is activated, then the only line terminators recognized are newline characters.&lt;/p&gt;
&lt;p&gt;The regular expression . matches any character except a line terminator unless the DOTALL flag is specified.&lt;/p&gt;
&lt;p&gt;By default, the regular expressions ^ and $ ignore line terminators and only match at the beginning and the end, respectively, of the entire input sequence. If MULTILINE mode is activated then ^ matches at the beginning of input and after any line terminator except at the end of input. When in MULTILINE mode $ matches just before a line terminator or the end of the input sequence.&lt;/p&gt;
&lt;a name=&quot;GroupsCapturing&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Groups and capturing&lt;/h3&gt;&lt;p&gt;Capturing groups are numbered by counting their opening parentheses from left to right. In the expression ((A)(B(C))), for example, there are four such groups:&lt;/p&gt;
&lt;blockquote&gt;&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;1&quot; summary=&quot;Capturing group numberings&quot;&gt;
&lt;tbody&gt;&lt;tr&gt;
&lt;th&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;((A)(B(C)))&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;(A)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;(B(C))&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;th&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/th&gt;&lt;td&gt;(C)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/blockquote&gt;&lt;p&gt;Group zero always stands for the entire expression.&lt;/p&gt;
&lt;p&gt;Capturing groups are so named because, during a match, each subsequence of the input sequence that matches such a group is saved. The captured subsequence may be used later in the expression, via a back reference, and may also be retrieved from the matcher once the match operation is complete.&lt;/p&gt;
&lt;p&gt;The captured input associated with a group is always the subsequence that the group most recently matched. If a group is evaluated a second time because of quantification then its previously-captured value, if any, will be retained if the second evaluation fails. Matching the string &quot;aba&quot; against the expression (a(b)?)+, for example, leaves group two set to &quot;b&quot;. All captured input is discarded at the beginning of each match.&lt;/p&gt;
&lt;p&gt;Groups beginning with (? are pure,&amp;nbsp;&lt;em&gt;non-capturing&lt;/em&gt;&amp;nbsp;groups that do not capture text and do not count towards the group total.&lt;/p&gt;
&lt;a name=&quot;UnicodeSupport&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Unicode support&lt;/h3&gt;&lt;p&gt;This class is in conformance with Level 1 of&amp;nbsp;&lt;a href=&quot;http://www.unicode.org/reports/tr18/&quot;&gt;&lt;em&gt;Unicode Technical Standard #18: Unicode Regular Expression Guidelines&lt;/em&gt;&lt;/a&gt;, plus RL2.1 Canonical Equivalents.&lt;/p&gt;
&lt;p&gt;Unicode escape sequences such as \u2014 in Java source code are processed as described in ?.3 of the Java Language Specification. Such escape sequences are also implemented directly by the regular-expression parser so that Unicode escapes can be used in expressions that are read from files or from the keyboard. Thus the strings &quot;\u2014&quot; and &quot;\\u2014&quot;, while not equal, compile into the same pattern, which matches the character with hexadecimal value 0x2014.&lt;/p&gt;
&lt;p&gt;Unicode blocks and categories are written with the \p and \P constructs as in Perl. \p{&lt;em&gt;prop&lt;/em&gt;} matches if the input has the property&amp;nbsp;&lt;em&gt;prop&lt;/em&gt;, while \P{&lt;em&gt;prop&lt;/em&gt;} does not match if the input has that property. Blocks are specified with the prefix In, as in InMongolian. Categories may be specified with the optional prefix Is: Both \p{L} and \p{IsL} denote the category of Unicode letters. Blocks and categories can be used both inside and outside of a character class.&lt;/p&gt;
&lt;p&gt;The supported categories are those of&amp;nbsp;&lt;a href=&quot;http://www.unicode.org/unicode/standard/standard.html&quot;&gt;&lt;em&gt;The Unicode Standard&lt;/em&gt;&lt;/a&gt;&amp;nbsp;in the version specified by the Character class. The category names are those defined in the Standard, both normative and informative. The block names supported by Pattern are the valid block names accepted and defined by UnicodeBlock.forName.&lt;/p&gt;
&lt;p&gt;Categories that behave like the java.lang.Character boolean is&lt;em&gt;methodname&lt;/em&gt;&amp;nbsp;methods (except for the deprecated ones) are available through the same \p{&lt;em&gt;prop&lt;/em&gt;} syntax where the specified property has the name java&lt;em&gt;methodname&lt;/em&gt;.&lt;/p&gt;
&lt;a name=&quot;ComparisonToPerl5&quot;&gt;&lt;/a&gt;&lt;h3 style=&quot;font-family: Verdana, Arial; &quot;&gt;Comparison to Perl 5&lt;/h3&gt;&lt;p&gt;The Pattern engine performs traditional NFA-based matching with ordered alternation as occurs in Perl 5.&lt;/p&gt;
&lt;p&gt;Perl constructs not supported by this class:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The conditional constructs (?{&lt;em&gt;X&lt;/em&gt;}) and (?(&lt;em&gt;condition&lt;/em&gt;)&lt;em&gt;X&lt;/em&gt;|&lt;em&gt;Y&lt;/em&gt;),&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The embedded code constructs (?{&lt;em&gt;code&lt;/em&gt;}) and (??{&lt;em&gt;code&lt;/em&gt;}),&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The embedded comment syntax (?#comment), and&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The preprocessing operations \l \u, \L, and \U.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Constructs supported by this class but not by Perl:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Possessive quantifiers, which greedily match as much as they can and do not back off, even when doing so would allow the overall match to succeed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Character-class union and intersection as described above.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Notable differences from Perl:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In Perl, \1 through \9 are always interpreted as back references; a backslash-escaped number greater than 9 is treated as a back reference if at least that many subexpressions exist, otherwise it is interpreted, if possible, as an octal escape. In this class octal escapes must always begin with a zero. In this class, \1 through \9 are always interpreted as back references, and a larger number is accepted as a back reference if at least that many subexpressions exist at that point in the regular expression, otherwise the parser will drop digits until the number is smaller or equal to the existing number of groups or it is one digit.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Perl uses the g flag to request a match that resumes where the last match left off. This functionality is provided implicitly by the Matcher class: Repeated invocations of the find method will resume where the last match left off, unless the matcher is reset.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Perl, embedded flags at the top level of an expression affect the whole expression. In this class, embedded flags always take effect at the point at which they appear, whether they are at the top level or within a group; in the latter case, flags are restored at the end of the group just as in Perl.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Perl is forgiving about malformed matching constructs, as in the expression *a, as well as dangling brackets, as in the expression abc], and treats them as literals. This class also accepts dangling brackets but is strict about dangling metacharacters like +, ? and *, and will throw a PatternSyntaxException if it encounters them.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class=&quot;modified&quot; style=&quot;font-size: 9pt; font-style: italic; &quot;&gt;
&lt;p align=&quot;right&quot;&gt;마지막 수정일: 2006년 8월 23일&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;div class=&quot;entry-ccl&quot; style=&quot;clear: both; text-align: right; margin-bottom: 10px&quot;&gt;
	&lt;a href=&quot;http://creativecommons.org/licenses/by/4.0/deed.ko&quot; target=&quot;_blank&quot; style=&quot;text-decoration: none&quot;&gt;
	&lt;img id=&quot;ccl-icon-42-0&quot; class=&quot;entry-ccl-by&quot; src=&quot;//i1.daumcdn.net/cfs.tistory/resource/4191/static/admin/editor/ccl_black01.png&quot; alt=&quot;저작자 표시&quot;/&gt;
	&lt;!--
	&lt;rdf:RDF xmlns=&quot;http://web.resource.org/cc/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot;&gt;
		&lt;Work rdf:about=&quot;&quot;&gt;
			&lt;license rdf:resource=&quot;http://creativecommons.org/licenses/by-fr/2.0/kr/&quot; /&gt;
		&lt;/Work&gt;
		&lt;License rdf:about=&quot;http://creativecommons.org/licenses/by-fr/&quot;&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Reproduction&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/Distribution&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Notice&quot;/&gt;
			&lt;requires rdf:resource=&quot;http://web.resource.org/cc/Attribution&quot;/&gt;
			&lt;permits rdf:resource=&quot;http://web.resource.org/cc/DerivativeWorks&quot;/&gt;
		&lt;/License&gt;
	&lt;/rdf:RDF&gt;
	--&gt;
	&lt;/a&gt;
&lt;/div&gt;
</description>
<category>SE</category>
<category>java</category>
<category>regexp</category>
<category>예제</category>
<category>자바</category>
<category>정규표현식</category>
<author>양군이당</author>
<guid>http://yanggoony.tistory.com/42</guid>
<comments>http://yanggoony.tistory.com/42#entry42comment</comments>
<pubDate>Sun, 16 May 2010 05:43:02 +0900</pubDate>
</item>
</channel>
</rss>