채택완료

js정규식 질문 좀 드립니다 .

2017-04-18 (화) 16:57:09 3,568
Copy
<div class="tbl_head01 tbl_wrap">    <div style="display: none;">bbs 목록</div>    <ul class="hbtable_wrap">        <li class="td_subject">            <label for="chk_wr_id_0" class="sound_only">[스킨] Gallery [반응형] 스킨입니다.</label>            <input type="checkbox" name="chk_wr_id[]" value="12" id="chk_wr_id_0">            <a href="http://127.0.0.1/gnu/bbs/board.php?bo_table=bbs&amp;wr_id=12">                스킨입니다.                      </a>            <img src="http://127.0.0.1/gnu/skin/board/basic/img/icon_new.gif" alt="새글">            <div class="td_nums">            <strong>공지</strong></div>        </li>        <li class="td_content">반응형으로 만든 갤러리 스킨입니다. ......</li>        <li class="td_hit">조회:3</li>        <li class="td_name sv_use"><span class="sv_member">최고관리자</span></li>        <li class="td_date">00:23</li>        <li>추천:0&nbsp;비추:0 </li>    </ul></div>

정규식을 자꾸 까먹어서요 질문 좀 드립니다 . 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개 / 댓글 2개

채택된 답변
+20 포인트

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

console.log(m[1]);

답변에 대한 댓글 1개

감사합니다 잘 작동 합니다.
2017-04-18 (화) 17:20:31

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

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

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

alert[əˈlɜrt]
Eng



adjective

1.fully aware and attentive; wide-awake; keen: an alert mind.

2.swift; agile; nimble.

noun

1.an attitude of vigilance, readiness, or caution, as before an expected attack.

2.a warning or alarm of an impending military attack, a storm, etc.: We'd just boarded the bus when the alert sounded.

3.the period during which such a warning or alarm is in effect.

verb (used with object)

1.to warn (troops, ships, etc.) to prepare for action.

2.to warn of an impending raid, attack, storm, etc.: The radio alerted coastal residents to prepare for the hurricane.

3.to advise or warn; cause to be on guard: to alert gardeners to the dangers of some pesticides.

Idioms

1.on the alert

on guard against danger; in readiness; vigilant: The state police are on the alert for an escaped convict believed to be in the area.

synonyms

awake, wary, observant.

brisk, lively, quick, active, sprightly, spirited.

antonyms

unaware.

{"entries":[]}

답변에 대한 댓글 1개

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

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