일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- createElement
- createtextnode
- boolean
- FOR
- 학습법 #집중력
- Let
- const
- VAR
- input
- appendChild
- Append
- htmlFor
- Openlayers
- Today
- Total
Atomic Habits
HWP - HTML 코드 변환 본문
X html - https://wordhtml.com/
O html - https://wordtohtml.net/
java - https://www.onlinegdb.com/online_java_compiler
웹소스코드 정렬 - https://tools.arantius.com/tabifier - https://beautifier.io/
소스코드 출력 웹페이지- https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default_default
public class Main { public static void main(String[] args) { String str = "" ; str = str.replaceAll("(<span style=\"[\\w].{1,30}bold.*?>)(?<text>.*?)(</span>)", "<strong>${text}</strong>"); str = str.replaceAll("(<p\\s?style.*?.+?)>", "<p>"); str = str.replaceAll("(<p\\s?style.*?.+?)(?=<| )", "<p>"); str = str.replaceAll("<span.*?>", "<span>"); str = str.replaceAll("<span>|</span>", ""); str = str.replaceAll(" ", " "); str = str.replaceAll("<p>\\s*</p>", ""); /* str = str.replaceAll(, ); */ str = str.replaceAll("<p> </p>|<p><strong> </strong></p>", "<br>"); str = str.replaceAll("href", "target=\"_blank\" href"); str = str.replaceAll("<p> </p>", "<br>"); str = str.replaceAll("“|”", "\""); str = str.replaceAll("‘|’", "\'"); str = str.replaceAll("<u>", "<span style=\"text-decoration: underline;\">"); str = str.replaceAll("</u>", "</span>"); str = str.replaceAll("(<span style=\"[\\w].{1,30}bold.*?>)(?<text>.*?)(</span>)", "<strong>${text}</strong>"); str = str.replaceAll("(<p\\s?style.*?.+?)>", "<p>"); str = str.replaceAll("(<p\\s?style.*?.+?)(?=<| )", "<p>"); str = str.replaceAll("<span.*?>", "<span>"); str = str.replaceAll("<span>|</span>", ""); str = str.replaceAll(" ", " "); str = str.replaceAll("<p>\\s*</p>", ""); /* str = str.replaceAll(, ); */ str = str.replaceAll("<p> </p>|<p><strong> </strong></p>", "<br>"); str = str.replaceAll("href", "target=\"_blank\" href"); str = str.replaceAll("<p> </p>", "<br>"); str = str.replaceAll("“|”", "\""); str = str.replaceAll("‘|’", "\'"); str = str.replaceAll("<u>", "<span style=\"text-decoration: underline;\">"); str = str.replaceAll("</u>", "</span>"); /* □,ㅇ,-로 시작하는 </p> 종료 */ str = str.replaceAll("(?<=(<p>[□ㅇ○◦-].{1,100000}))</p>", "</span></p>"); /*str = str.replaceAll("(?<=<p>(□ㅇ○).*)</p>", "</span></p>"); /* *로 시작하는 </p> 종료 */ str = str.replaceAll("(?<!(<p>[□ㅇ○◦].{1,100000}+))</p>", "</span></p>"); /* </span> /* □로 시작 */ str = str.replaceAll("<p>(?!\\*)□\\s*", "<br> <p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\">"); /* ㅇ, -로 시작 */ str = str.replaceAll("<p>\\s?(?!\\*)[ㅇ○◦-]\\s*", "<p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\">"); /* *로 시작 (<p>*는 가장 마지막에 따로 테스트) */ str = str.replaceAll("<p>\\s*?(?=\\*)", "<br> <span style=\"font-size: 10pt; font-family: notokr, sans-serif;\">"); /* < 괄호 볼드체 글 > 시작, 종료 */ str = str.replaceAll("<p>\\s{0,3}<strong>{0,3}<", "<p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\"><strong><"); /*str = str.replaceAll(">\\s{0,3}</strong>\\s{0,3}</p>", ">\\s{0,3}</strong></span></p>"); */ /* URL */ str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>[a-zA-Z/\\-?=%.]{2,}\\.[a-zA-Z/\\-?=%.]{2,})(?=\\)|\\,|\\<\\/strong)", "<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>"); /* 위에 코드 미작동 시 +로 변경 str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>[\\w/\\-?=%.]{2,}\\.[\\w/\\-?=%.]{2,})(?=\\)|\\<\\/strong)", "(<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>)"); */ /* www : str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>(www\\.)[\\w/\\-?=%.]+\\.[\\w/\\-?=%.]+)(?=\\)|\\<\\/strong)", "(<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>)"); */ str = str.replaceAll("href=\"(?!http|http)", "href=\"http://"); /* * 라인을 바로 위 <p> tag 안으로 넣기 */ str = str.replaceAll("</span>\\s*</p>\\s*<br>\\s*<span", "</span><br><span"); /* 가장 처음 <br> 제거 */ str = str.replaceFirst("<br>\\s?", ""); /* 시작 열 */ str = str.replaceFirst("\\<", "<div style=\"word-break: keep-all; text-align: justify; text-justify: inter-word; \"><"); /* 숫자 강조 */ /*str = "<div style=\"word-break: keep-all; text-align: justify; text-justify: inter-word; \"> <p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\">국토교통부(장관 노형욱)는 <strong>제29차 도시재생특별위원회</strong>(위원장 김부겸 국무총리)*를 통해, 올해 3<strong>차 신규 도시재생 뉴딜사업</strong>으로 서울 강서, 경기 안양 등 <strong>총 32곳을 선정</strong>하였다.</span><br> <span style=\"font-size: 10pt; font-family: notokr, sans-serif;\">* 도시재생특별위원회 : 국무총리(위원장), 경제·산업·문화·도시·건축·복지 등 각 분야 민간위원(13명), 정부위원(기재·국토 등 16개 관계부처 장관·청장)</span> </p> <br> <p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\">선정된 32곳의 사업지에 <strong>'28년까지 </strong>국비 0.3조원, <strong>민간자본 3.3조원</strong> 등 <strong>총 5.2조원*</strong>을 투입하여 <strong>쇠퇴지역 280만m2를 재생</strong>하고,</span><br> <span style=\"font-size: 10pt; font-family: notokr, sans-serif;\">* 국비 2.7천억, 지방비 2.1천억, 부처연계 2.1천억, 지자체 3.4천억, 공공기관 7.2천억, 기금 0.7천억, 민간 33.6천억 등</span> </p> <p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\"><strong>신규주택 약 2,500호</strong>와 <strong>창업지원시설 22개</strong>, 생활SOC시설 58개 등 공급을 통해 <strong>주거환경</strong>을 <strong>개선</strong>하고, <strong>약 4.4만개</strong>의 <strong>일자리</strong>가 <strong>창출</strong>될 전망이다.</span> </p>"; */ str = str.replaceAll("</strong>(?<strongnum>[0-9]\\,?\\.?[0-9]?[0-9]?[0-9]?)<strong>", "${strongnum}"); str = str.replaceAll("</strong><strong>", ""); str = str.replaceAll("</strong> <strong>", " "); str = str.replaceAll("(?<=[0-9])만호", "만 호"); str = str.replaceAll("(?<=[0-9])만여호", "만여 호"); str = str.replaceAll("(?<=[0-9])천호", "천 호"); str = str.replaceAll("(?<=[0-9])천여호", "천여 호"); str = str.replaceAll("(?<=[0-9])백호", "백 호"); str = str.replaceAll("(?<=[0-9])백여호", "백여 호"); str = str.replaceAll("(?<=[0-9])십호", "십 호"); str = str.replaceAll("(?<=[0-9])십여호", "십여 호"); str = str.replaceAll("(?<=[0-9])백명", "백 명"); str = str.replaceAll("(?<=[0-9])천명", "천 명"); str = str.replaceAll("(?<=[0-9])만명", "만 명"); str = str.replaceAll("(?<=[0-9])억원", "억 원"); str = str.replaceAll("(?<=[0-9])만원", "만 원"); str = str.replaceAll("(?<=[0-9])천원", "천 원"); str = str.replaceAll("[➊❶➀①⓵]", "①"); str = str.replaceAll("[➋❷➁②⓶]", "②"); str = str.replaceAll("[➌❸➂③⓷]", "③"); str = str.replaceAll("[➍❹➃④⓸]", "④"); str = str.replaceAll("[➎❺➄⑤⓹]", "⑤"); str = str.replaceAll("▪", "■"); str = str.replaceAll("・", "·"); str = str.replaceAll("ㆍ", "·"); str = str.replaceAll("·", "·"); str = str.replaceAll("․", "·"); str = str.replaceAll("‧", "·"); str = str.replaceAll("`", "\'"); str = str.replaceAll("–", "-"); str = str.replaceAll("mm|m</strong><strong>m", "㎜"); str = str.replaceAll("cm|c</strong><strong>m", "㎝"); str = str.replaceAll("m2|m</strong><strong>2", "㎡"); str = str.replaceAll("m3|m</strong><strong>3", "㎥"); str = str.replaceAll("km|k</strong><strong>m", "㎞"); str = str.replaceAll("km2|k</strong><strong>m</strong><strong>2", "㎢"); str = str.replaceAll("km3|k</strong><strong>m</strong><strong>3", "㎦"); str = str.replaceAll("‘", "'"); str = str.replaceAll("’", "'"); str = str.replaceAll("“", "\""); str = str.replaceAll("”", "\""); str = str.replaceAll("「", "「"); str = str.replaceAll("」", "」"); str = str.replaceAll("∼", "~"); /* 가장 마지막 열 </div> */ str = str.replaceAll( "</p>$", "</p></div>"); System.out.println(str); } }
.
public class Main
{
public static void main(String[] args) {
String str =
""
;
str = str.replaceAll("(<span style=\"[\\w].{1,30}bold.*?>)(?<text>.*?)(</span>)", "<strong>${text}</strong>");
str = str.replaceAll("(<p\\s?style.*?.+?)>", "<p>"); str = str.replaceAll("(<p\\s?style.*?.+?)(?=<| )", "<p>");
str = str.replaceAll("<span.*?>", "<span>"); str = str.replaceAll("<span>|</span>", "");
str = str.replaceAll(" ", " "); str = str.replaceAll("<p>\\s*</p>", ""); /* str = str.replaceAll(, ); */
str = str.replaceAll("<p> </p>|<p><strong> </strong></p>", "<br>");
str = str.replaceAll("href", "target=\"_blank\" href"); str = str.replaceAll("<p> </p>", "<br>");
str = str.replaceAll("“|”", "\""); str = str.replaceAll("‘|’", "\'");
str = str.replaceAll("<u>", "<span style=\"text-decoration: underline;\">");
str = str.replaceAll("</u>", "</span>");
str = str.replaceAll("(<span style=\"[\\w].{1,30}bold.*?>)(?<text>.*?)(</span>)", "<strong>${text}</strong>");
str = str.replaceAll("(<p\\s?style.*?.+?)>", "<p>"); str = str.replaceAll("(<p\\s?style.*?.+?)(?=<| )", "<p>");
str = str.replaceAll("<span.*?>", "<span>"); str = str.replaceAll("<span>|</span>", "");
str = str.replaceAll(" ", " "); str = str.replaceAll("<p>\\s*</p>", ""); /* str = str.replaceAll(, ); */
str = str.replaceAll("<p> </p>|<p><strong> </strong></p>", "<br>");
str = str.replaceAll("href", "target=\"_blank\" href"); str = str.replaceAll("<p> </p>", "<br>");
str = str.replaceAll("“|”", "\""); str = str.replaceAll("‘|’", "\'");
str = str.replaceAll("<u>", "<span style=\"text-decoration: underline;\">");
str = str.replaceAll("</u>", "</span>");
/* □,ㅇ,-로 시작하는 </p> 종료 */
str = str.replaceAll("(?<=(<p>[□ㅇ○◦-].{1,100000}))</p>", "</span></p>");
/*str = str.replaceAll("(?<=<p>(□ㅇ○).*)</p>", "</span></p>");
/* *로 시작하는 </p> 종료 */
str = str.replaceAll("(?<!(<p>[□ㅇ○◦].{1,100000}+))</p>", "</span></p>"); /* </span>
/* □로 시작 */
str = str.replaceAll("<p>(?!\\*)□\\s*", "<br> <p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\">");
/* ㅇ, -로 시작 */
str = str.replaceAll("<p>\\s?(?!\\*)[ㅇ○◦-]\\s*", "<p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\">");
/* *로 시작 (<p>*는 가장 마지막에 따로 테스트) */
str = str.replaceAll("<p>\\s*?(?=\\*)", "<br> <span style=\"font-size: 10pt; font-family: notokr, sans-serif;\">");
/* < 괄호 볼드체 글 > 시작, 종료 */
str = str.replaceAll("<p>\\s{0,3}<strong>{0,3}<", "<p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\"><strong><");
/*str = str.replaceAll(">\\s{0,3}</strong>\\s{0,3}</p>", ">\\s{0,3}</strong></span></p>"); */
/* URL */
str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>[a-zA-Z/\\-?=%.]{2,}\\.[a-zA-Z/\\-?=%.]{2,})(?=\\)|\\,|\\<\\/strong)", "<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>");
/* 위에 코드 미작동 시 +로 변경 str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>[\\w/\\-?=%.]{2,}\\.[\\w/\\-?=%.]{2,})(?=\\)|\\<\\/strong)", "(<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>)"); */
/* www : str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>(www\\.)[\\w/\\-?=%.]+\\.[\\w/\\-?=%.]+)(?=\\)|\\<\\/strong)", "(<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>)"); */
str = str.replaceAll("href=\"(?!http|http)", "href=\"http://");
/* * 라인을 바로 위 <p> tag 안으로 넣기 */
str = str.replaceAll("</span>\\s*</p>\\s*<br>\\s*<span", "</span><br><span");
/* 가장 처음 <br> 제거 */
str = str.replaceFirst("<br>\\s?", "");
/* 시작 열 */
str = str.replaceFirst("\\<", "<div style=\"word-break: keep-all; text-align: justify; text-justify: inter-word; \"><");
/* 숫자 강조 */
/*str = "<div style=\"word-break: keep-all; text-align: justify; text-justify: inter-word; \"> <p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\">국토교통부(장관 노형욱)는 <strong>제29차 도시재생특별위원회</strong>(위원장 김부겸 국무총리)*를 통해, 올해 3<strong>차 신규 도시재생 뉴딜사업</strong>으로 서울 강서, 경기 안양 등 <strong>총 32곳을 선정</strong>하였다.</span><br> <span style=\"font-size: 10pt; font-family: notokr, sans-serif;\">* 도시재생특별위원회 : 국무총리(위원장), 경제·산업·문화·도시·건축·복지 등 각 분야 민간위원(13명), 정부위원(기재·국토 등 16개 관계부처 장관·청장)</span> </p> <br> <p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\">선정된 32곳의 사업지에 <strong>'28년까지 </strong>국비 0.3조원, <strong>민간자본 3.3조원</strong> 등 <strong>총 5.2조원*</strong>을 투입하여 <strong>쇠퇴지역 280만m2를 재생</strong>하고,</span><br> <span style=\"font-size: 10pt; font-family: notokr, sans-serif;\">* 국비 2.7천억, 지방비 2.1천억, 부처연계 2.1천억, 지자체 3.4천억, 공공기관 7.2천억, 기금 0.7천억, 민간 33.6천억 등</span> </p> <p style=\"font-family: notokr, sans-serif; font-size: 12pt; line-height: 22px; margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, sans-serif;\"><strong>신규주택 약 2,500호</strong>와 <strong>창업지원시설 22개</strong>, 생활SOC시설 58개 등 공급을 통해 <strong>주거환경</strong>을 <strong>개선</strong>하고, <strong>약 4.4만개</strong>의 <strong>일자리</strong>가 <strong>창출</strong>될 전망이다.</span> </p>"; */
str = str.replaceAll("</strong>(?<strongnum>[0-9]\\,?\\.?[0-9]?[0-9]?[0-9]?)<strong>", "${strongnum}");
str = str.replaceAll("</strong><strong>", ""); str = str.replaceAll("</strong> <strong>", " ");
str = str.replaceAll("(?<=[0-9])만호", "만 호"); str = str.replaceAll("(?<=[0-9])만여호", "만여 호");
str = str.replaceAll("(?<=[0-9])천호", "천 호"); str = str.replaceAll("(?<=[0-9])천여호", "천여 호");
str = str.replaceAll("(?<=[0-9])백호", "백 호"); str = str.replaceAll("(?<=[0-9])백여호", "백여 호");
str = str.replaceAll("(?<=[0-9])십호", "십 호"); str = str.replaceAll("(?<=[0-9])십여호", "십여 호");
str = str.replaceAll("(?<=[0-9])백명", "백 명");
str = str.replaceAll("(?<=[0-9])천명", "천 명");
str = str.replaceAll("(?<=[0-9])만명", "만 명");
str = str.replaceAll("(?<=[0-9])억원", "억 원");
str = str.replaceAll("(?<=[0-9])만원", "만 원");
str = str.replaceAll("(?<=[0-9])천원", "천 원");
str = str.replaceAll("[➊❶➀①⓵]", "①");
str = str.replaceAll("[➋❷➁②⓶]", "②");
str = str.replaceAll("[➌❸➂③⓷]", "③");
str = str.replaceAll("[➍❹➃④⓸]", "④");
str = str.replaceAll("[➎❺➄⑤⓹]", "⑤");
str = str.replaceAll("▪", "■");
str = str.replaceAll("・", "·"); str = str.replaceAll("ㆍ", "·"); str = str.replaceAll("·", "·");
str = str.replaceAll("․", "·"); str = str.replaceAll("‧", "·"); str = str.replaceAll("`", "\'");
str = str.replaceAll("–", "-");
str = str.replaceAll("mm|m</strong><strong>m", "㎜"); str = str.replaceAll("cm|c</strong><strong>m", "㎝");
str = str.replaceAll("m2|m</strong><strong>2", "㎡"); str = str.replaceAll("m3|m</strong><strong>3", "㎥");
str = str.replaceAll("km|k</strong><strong>m", "㎞"); str = str.replaceAll("km2|k</strong><strong>m</strong><strong>2", "㎢");
str = str.replaceAll("km3|k</strong><strong>m</strong><strong>3", "㎦");
str = str.replaceAll("‘", "'"); str = str.replaceAll("’", "'"); str = str.replaceAll("“", "\"");
str = str.replaceAll("”", "\""); str = str.replaceAll("「", "「"); str = str.replaceAll("」", "」");
str = str.replaceAll("∼", "~");
/* 가장 마지막 열 </div> */
str = str.replaceAll( "</p>$", "</p></div>");
System.out.println(str);
}
}
//➊➋➌❶❷❸❹❺❻❼❽❾❿➀➁➂➃➄➅➆➇➈➉①②③④⑤⑥⑦⑧⑨⓵⓶⓷⓸⓹⓺⓻⓼⓽⓾
//가능 ①②③④⑤⑥⑦⑧⑨⑩
1) strong
2) table width=1, compress, target="_blank"( [V] open in new tab ), index, [compress X]
- https://wordtohtml.net/site/index#
3) replace
- https://www.regexplanet.com/advanced/java/index.html 정규식 자바형 변환
- https://coding.tools/regex-replace 정규식 치환
- https://onlinetexttools.com/replace-text 정규식 치환
- https://regexr.com/ (정규식 테스트)
3) 웹페이지 출력
- https://www.w3schools.com/html/tryit.asp?filename=tryhtml_default_default
compress(html > 좌측 상단 4번째 아이콘), a-link
4) 온라인 자바 컴파일러
- https://www.onlinegdb.com/online_java_compiler (잘 출력됨)
- https://ideone.com/veMwJ7 (잘 출력됨)
- https://replit.com/languages/java10 (* 라인이 아래로 쳐짐)
- https://www.onlinegdb.com/online_java_compiler
- https://www.jdoodle.com/online-java-compiler/
- https://www.tutorialspoint.com/compile_java_online.php
- https://www.compilejava.net/
자바 컴파일러 https://www.onlinegdb.com/online_java_compiler
정규식 테스트 https://regexr.com/
정규식 자바형 변환 https://www.regexplanet.com/advanced/java/index.html
한줄 압축 https://www.html-cleaner.com/css/
html 체크 https://validator.w3.org/nu/#textarea
정규식 시각화 https://wordhtml.com/
html 변환 (b)
o https://wordtohtml.net/ 동일
x https://wordhtml.com/ 동일 COMPRESS
x https://htmled.it/ 동일 글자수 제한 COMPRESS
x https://www.html-cleaner.com/ 동일 (※ CSS에서 COMPRESS 후 자바 변환 시 * 라인 흐트러짐)
===============================================
indent 제거
- https://www.html-cleaner.com/
compress
- https://www.html-cleaner.com/css/
===============================================
backup
public class Main { public static void main(String[] args) { String str = "" ; str = str.replaceAll("(?<=[0-9])만호", "만 호"); str = str.replaceAll("(?<=[0-9])억원", "억 원"); str = str.replaceAll("(?<=[0-9])천호", "천 호"); str = str.replaceAll("(?<=[0-9])백명", "백 명"); str = str.replaceAll("(?<=[0-9])천명", "천 명"); str = str.replaceAll("(?<=[0-9])만명", "만 명"); str = str.replaceAll("(<span style=\"[\\w].{1,30}bold.*?>)(?<text>.*?)(</span>)", "<strong>${text}</strong>"); str = str.replaceAll("(<p\\s?style.*?.+?)>", "<p>"); str = str.replaceAll("(<p\\s?style.*?.+?)(?=<| )", "<p>"); str = str.replaceAll("<span.*?>", "<span>"); str = str.replaceAll("<span>|</span>", ""); str = str.replaceAll(" ", " "); str = str.replaceAll("<p>\\s*</p>", ""); /* str = str.replaceAll(, ); */ str = str.replaceAll("<p> </p>|<p><strong> </strong></p>", "<br>"); str = str.replaceAll("href", "target=\"_blank\" href"); str = str.replaceAll("<p> </p>", "<br>"); str = str.replaceAll("“|”", "\""); str = str.replaceAll("‘|’", "\'"); str = str.replaceAll("<u>", "<span style=\"text-decoration: underline;\">"); str = str.replaceAll("</u>", "</span>"); /* □,ㅇ,-로 시작하는 </p> 종료 */ str = str.replaceAll("(?<=(<p>[□ㅇ○◦-].+))</p>", "</span></p>"); /*str = str.replaceAll("(?<=<p>(□ㅇ○).*)</p>", "</span></p>"); /* *로 시작하는 </p> 종료 */ str = str.replaceAll("(?<!(<p>[□ㅇ○◦].+))</p>", "</span></p>"); /* </span> /* □로 시작 */ str = str.replaceAll("<p>(?!\\*)□\\s*", "<br> <p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\">"); /* ㅇ, -로 시작 */ str = str.replaceAll("<p>\\s?(?!\\*)[ㅇ○◦-]\\s*", "<p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\">"); /* *로 시작 (<p>*는 가장 마지막에 따로 테스트) */ str = str.replaceAll("<p>\\s*?(?=\\*)", "<br> <span style=\"font-size: 10pt; font-family: notokr, "Malgun Gothic", sans-serif;\">"); /* < 괄호 볼드체 글 > 시작, 종료 */ str = str.replaceAll("<p>\\s{0,3}<strong>{0,3}<", "<p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\"><strong><"); /*str = str.replaceAll(">\\s{0,3}</strong>\\s{0,3}</p>", ">\\s{0,3}</strong></span></p>"); */ /* URL */ str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>[a-zA-Z/\\-?=%.]{2,}\\.[a-zA-Z/\\-?=%.]{2,})(?=\\)|\\,|\\<\\/strong)", "<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>"); /* 위에 코드 미작동 시 +로 변경 str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>[\\w/\\-?=%.]{2,}\\.[\\w/\\-?=%.]{2,})(?=\\)|\\<\\/strong)", "(<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>)"); */ /* www : str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>(www\\.)[\\w/\\-?=%.]+\\.[\\w/\\-?=%.]+)(?=\\)|\\<\\/strong)", "(<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>)"); */ str = str.replaceAll("href=\"(?!http|http)", "href=\"http://"); /* * 라인을 바로 위 <p> tag 안으로 넣기 */ str = str.replaceAll("</span>\\s*</p>\\s*<br>\\s*<span", "</span><br><span"); /* 가장 처음 <br> 제거 */ str = str.replaceFirst("<br>\\s?", ""); /* 시작 열 */ str = str.replaceFirst("\\<", "<div style=\"word-break: keep-all; text-align: justify; text-justify: inter-word; \"><"); /* 가장 마지막 열 </div> */ str = str.replaceAll("\\<\\/p\\>\\s*\\n$", "</p></div>"); /* 숫자 강조 */ /*str = "<div style=\"word-break: keep-all; text-align: justify; text-justify: inter-word; \"> <p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\">국토교통부(장관 노형욱)는 <strong>제29차 도시재생특별위원회</strong>(위원장 김부겸 국무총리)*를 통해, 올해 3<strong>차 신규 도시재생 뉴딜사업</strong>으로 서울 강서, 경기 안양 등 <strong>총 32곳을 선정</strong>하였다.</span><br> <span style=\"font-size: 10pt; font-family: notokr, "Malgun Gothic", sans-serif;\">* 도시재생특별위원회 : 국무총리(위원장), 경제·산업·문화·도시·건축·복지 등 각 분야 민간위원(13명), 정부위원(기재·국토 등 16개 관계부처 장관·청장)</span> </p> <br> <p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\">선정된 32곳의 사업지에 <strong>'28년까지 </strong>국비 0.3조원, <strong>민간자본 3.3조원</strong> 등 <strong>총 5.2조원*</strong>을 투입하여 <strong>쇠퇴지역 280만m2를 재생</strong>하고,</span><br> <span style=\"font-size: 10pt; font-family: notokr, "Malgun Gothic", sans-serif;\">* 국비 2.7천억, 지방비 2.1천억, 부처연계 2.1천억, 지자체 3.4천억, 공공기관 7.2천억, 기금 0.7천억, 민간 33.6천억 등</span> </p> <p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\"><strong>신규주택 약 2,500호</strong>와 <strong>창업지원시설 22개</strong>, 생활SOC시설 58개 등 공급을 통해 <strong>주거환경</strong>을 <strong>개선</strong>하고, <strong>약 4.4만개</strong>의 <strong>일자리</strong>가 <strong>창출</strong>될 전망이다.</span> </p>"; */ str = str.replaceAll("</strong>(?<strongnum>[0-9]\\,?\\.?[0-9]?[0-9]?[0-9]?)<strong>", "${strongnum}"); str = str.replaceAll("</strong><strong>", ""); str = str.replaceAll("</strong> <strong>", " "); str = str.replaceAll("▪", "■"); str = str.replaceAll("・", "·"); str = str.replaceAll("ㆍ", "·"); str = str.replaceAll("·", "·"); str = str.replaceAll("․", "·"); str = str.replaceAll("‧", "·"); str = str.replaceAll("`", "\'"); str = str.replaceAll("–", "-"); str = str.replaceAll("mm|m</strong><strong>m", "㎜"); str = str.replaceAll("cm|c</strong><strong>m", "㎝"); str = str.replaceAll("m2|m</strong><strong>2", "㎡"); str = str.replaceAll("m3|m</strong><strong>3", "㎥"); str = str.replaceAll("km|k</strong><strong>m", "㎞"); str = str.replaceAll("km2|k</strong><strong>m</strong><strong>2", "㎢"); str = str.replaceAll("km3|k</strong><strong>m</strong><strong>3", "㎦"); str = str.replaceAll("‘", "'"); str = str.replaceAll("’", "'"); str = str.replaceAll("“", "\""); str = str.replaceAll("”", "\""); str = str.replaceAll("「", "「"); str = str.replaceAll("」", "」"); str = str.replaceAll("∼", "~"); System.out.println(str); } }
...
public class Main
{
public static void main(String[] args) {
String str =
;
str = str.replaceAll("<p> </p>|<p><strong> </strong></p>", "");
str = str.replaceAll("href", "target=\"_blank\" href");
str = str.replaceAll("∼", "~");
str = str.replaceAll("ㆍ", "·");
str = str.replaceAll("‘", "'");
str = str.replaceAll("’", "'");
str = str.replaceAll("“", "\"");
str = str.replaceAll("”", "\"");
str = str.replaceAll("「", "「");
str = str.replaceAll("」", "」");
str = str.replaceAll("</strong><strong>", "");
str = str.replaceAll("<p> </p>", "<br>");
str = str.replaceAll("“|”", "\"");
str = str.replaceAll("‘|’", "\'");
str = str.replaceAll("<u>", "<span style=\"text-decoration: underline;\">");
str = str.replaceAll("</u>", "</span>");
// □,ㅇ,-로 시작하는 </p> 종료
str = str.replaceAll("(?<=(<p>[□ㅇ-].+))</p>", "</span></p>");
//str = str.replaceAll("(?<=<p>(□|ㅇ).*)</p>", "</span></p>");
// *로 시작하는 </p> 종료
str = str.replaceAll("(?<!(<p>[□ㅇ].+))</p>", "</span></p>"); // </span>
// □로 시작
str = str.replaceAll("<p>(?!\\*)□\\s*", "<br> <p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\">");
// ㅇ, -로 시작
str = str.replaceAll("<p>(?!\\*)[ㅇ-]\\s*", "<p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\">");
// *로 시작 (<p>*는 가장 마지막에 따로 테스트)
str = str.replaceAll("<p>(?=\\*)", "<br> <span style=\"font-size: 10pt; font-family: notokr, "Malgun Gothic", sans-serif;\">");
// < 괄호 볼드체 글 > 시작, 종료
str = str.replaceAll("<p>\\s{0,3}<strong>{0,3}<", "<p style=\"font-family: notokr, "Malgun Gothic", sans-serif; font-size: 12pt; line-height: 22px; color: rgb(0, 0, 0); margin: 12px 0px;\"> <span style=\"letter-spacing: -0.06em; font-family: notokr, "Malgun Gothic", sans-serif;\"><strong><");
str = str.replaceAll(">\\s{0,3}</strong>\\s{0,3}</p>", ">\\s{0,3}</strong></span></p>");
str = str.replaceAll("<p>(<strong>|<b>)", "■■■■■■■■");
str = str.replaceAll("(</strong>|<b>)</p>", "■■■■■■■■");
String str5 =
"<p>* 국제주택도시금융포럼 누리집(<a href=\"http://www.huf.or.kr\"><u>www.huf.or.kr</u></a>), 유튜브 채널 “HUG TV”</p> \n"+
"<p>ㅇ누리집(https://www.molit.go.kr) “정책자료/법령정보/입법예고・행정예고”에서 볼 수 있으며, \n"+
"<p>ㅇ누리집(www.molit.go.kr) “정책자료/법령정보/입법예고・행정예고”에서 볼 수 있으며, \n"+
"<p><u><strong>추정 분양가 검증</strong></u><u><strong>(HUG)</strong></u> ⇨ 사전당첨자</p>"
;
// URL
str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>[\\w/\\-?=%.]+\\.[\\w/\\-?=%.]+)(?=\\)|\\<\\/strong)", "(<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>)");
// www : str = str.replaceAll("(?<prot>(https?|ftp):\\/\\/)?(?<url>(www\\.)[\\w/\\-?=%.]+\\.[\\w/\\-?=%.]+)(?=\\)|\\<\\/strong)", "(<a href=\"${prot}${url}\" target=\"_blank\">${prot}${url}</a>)");
str = str.replaceAll("href=\"(?!http|http)", "href=\"http://");
// * 라인을 바로 위 <p> tag 안으로 넣기
str = str.replaceAll("</span>\\s*</p>\\s*<br>\\s*<span", "</span><br><span");
//str = str.replaceAll(, );
// 가장 처음 <br> 제거
str = str.replaceFirst("<br>\\s?", "");
// 공백 제거
str5 = str.replaceAll(" ", "");
// 시작 열
str = str.replaceFirst("\\<", "<div style=\"word-break: keep-all; text-align: justify; text-justify: inter-word; \"><");
// 가장 마지막 열 </div>
str5 = str.replaceAll("\\<\\/p\\>\\s*\\n$", "</p></div>");
System.out.println(str);
}
}
'IT > comp' 카테고리의 다른 글
Postman Post HTTP 요청 테스트 (0) | 2022.04.24 |
---|---|
TXT-HTML 변환(생)2 (0) | 2021.12.08 |