테스트 사이트 - 개발 중인 베타 버전입니다

js정규식 질문 좀 드립니다 . 채택완료

hb망고 8년 전 조회 3,344
</strong><span style="font-size: 10.5pt; line-height: 1.5; color: rgb(0, 0, 128);"><</span><span style="font-size: 10.5pt; line-height: 1.5; color: rgb(0, 0, 128); font-weight: bold;">div </span><span style="font-size: 10.5pt; line-height: 1.5; color: rgb(0, 153, 0);">class=</span><span style="font-size: 10.5pt; line-height: 1.5; color: rgb(206, 123, 0);">"tbl_head01 tbl_wrap"</span><span style="font-size: 10.5pt; line-height: 1.5; color: rgb(0, 0, 128);">></span>
<pre style="font-family: Consolas; font-size: 10.5pt;"><span style="color: rgb(0, 0, 128);">    <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">div </span><span style="color: rgb(0, 153, 0);">style=</span><span style="color: rgb(206, 123, 0);">"</span><span style="font-weight: bold;">display</span>: none;<span style="color: rgb(206, 123, 0);">"</span><span style="color: rgb(0, 0, 128);">></span>bbs <span style="font-family: 宋体;">목록</span><span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">div</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">    <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">ul </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"hbtable_wrap"</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">        <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"td_subject"</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">            <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">label </span><span style="color: rgb(0, 153, 0);">for=</span><span style="color: rgb(206, 123, 0);">"chk_wr_id_0" </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"sound_only"</span><span style="color: rgb(0, 0, 128);">></span>[<span style="font-family: 宋体;">스킨</span>] Gallery [<span style="font-family: 宋体;">반응형</span>] <span style="font-family: 宋体;">스킨입니다</span>.<span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">label</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">            <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">input </span><span style="color: rgb(0, 153, 0);">type=</span><span style="color: rgb(206, 123, 0);">"checkbox" </span><span style="color: rgb(0, 153, 0);">name=</span><span style="color: rgb(206, 123, 0);">"chk_wr_id[]" </span><span style="color: rgb(0, 153, 0);">value=</span><span style="color: rgb(206, 123, 0);">"12" </span><span style="color: rgb(0, 153, 0);">id=</span><span style="color: rgb(206, 123, 0);">"chk_wr_id_0"</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">            <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">a </span><span style="color: rgb(0, 153, 0);">href=</span><span style="color: rgb(206, 123, 0);">"<a href="http://127.0.0.1/gnu/bbs/board.php?bo_table=bbs" target="_blank" rel="noopener noreferrer">http://127.0.0.1/gnu/bbs/board.php?bo_table=bbs</a></span><span style="font-weight: bold;">&amp;</span><span style="color: rgb(206, 123, 0);">wr_id=12"</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">                </span><span style="font-family: 宋体;">스킨입니다</span>.                      <span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">a</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">            <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">img </span><span style="color: rgb(0, 153, 0);">src=</span><span style="color: rgb(206, 123, 0);">"<a href="http://127.0.0.1/gnu/skin/board/basic/img/icon_new.gif" target="_blank" rel="noopener noreferrer">http://127.0.0.1/gnu/skin/board/basic/img/icon_new.gif</a>" </span><span style="color: rgb(0, 153, 0);">alt=</span><span style="color: rgb(206, 123, 0);">"</span><span style="color: rgb(206, 123, 0); font-family: 宋体;">새글</span><span style="color: rgb(206, 123, 0);">"</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">            <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">div </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"td_nums"</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">            <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">strong</span><span style="color: rgb(0, 0, 128);">></span><span style="font-family: 宋体;">공지</span><span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">strong</span><span style="color: rgb(0, 0, 128);">></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">div</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">        </</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">        <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"td_content"</span><span style="color: rgb(0, 0, 128);">></span><span style="font-family: 宋体;">반응형으로 만든 갤러리 스킨입니다</span>. ......<span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">        <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"td_hit"</span><span style="color: rgb(0, 0, 128);">></span><span style="font-family: 宋体;">조회</span>:3<span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">        <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"td_name sv_use"</span><span style="color: rgb(0, 0, 128);">><</span><span style="color: rgb(0, 0, 128); font-weight: bold;">span </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"sv_member"</span><span style="color: rgb(0, 0, 128);">></span><span style="font-family: 宋体;">최고관리자</span><span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">span</span><span style="color: rgb(0, 0, 128);">></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">        <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li </span><span style="color: rgb(0, 153, 0);">class=</span><span style="color: rgb(206, 123, 0);">"td_date"</span><span style="color: rgb(0, 0, 128);">></span>00:23<span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">        <</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li</span><span style="color: rgb(0, 0, 128);">></span><span style="font-family: 宋体;">추천</span>:0<span style="font-weight: bold;"> </span><span style="font-family: 宋体;">비추</span>:0 <span style="color: rgb(0, 0, 128);"></</span><span style="color: rgb(0, 0, 128); font-weight: bold;">li</span><span style="color: rgb(0, 0, 128);">>
</span><span style="color: rgb(0, 0, 128);">    </</span><span style="color: rgb(0, 0, 128); font-weight: bold;">ul</span><span style="color: rgb(0, 0, 128);">>
</span></pre><p><span style="font-size: 10.5pt; line-height: 1.5; color: rgb(0, 0, 128);"></</span><span style="font-size: 10.5pt; line-height: 1.5; color: rgb(0, 0, 128); font-weight: bold;">div</span><span style="font-size: 10.5pt; line-height: 1.5; color: rgb(0, 0, 128);">></span><strong style="color: rgb(127, 127, 127); font-family: 돋움, Dotum, sans-serif; font-size: 12px; line-height: normal;">


정규식을 자꾸 까먹어서요 질문 좀 드립니다 . js로 <div class="tbl_head01 tbl_wrap"></div> 사이의 내용만 빼오고 싶습니다 .
data.match(/<div class=\"tbl_head01 tbl_wrap\">\r\n(.*)<\/div>) 이렇게 하니깐 
<div class="tbl_head01 tbl_wrap">
    <div style="display: none;">bbs 목록</div> 요기 까지만 짤립니다 .

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트
8년 전

var m = /<div class="tbl_head01 tbl_wrap">([\S\s]+)<\/div>/.exec(data); 

console.log(m[1]);

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

h
hb망고
8년 전
감사합니다 잘 작동 합니다.

댓글을 작성하려면 로그인이 필요합니다.

js 정규식은 모르겠지만, jqury로 하면  

 

var data = $(".tbl_head01 .tbl_wrap").html(); 

 

jquery.html() 명령어로 빼면 될것같네요. 

 

 

 

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

h
hb망고
8년 전
원격에서 받아온 내용을 다시 가공하는 한다는 의미에서 정규식이 필요 한건데 제가 설명이 부족햇나 봅니다 .
답변 감사합니다 ~

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인