0
이 같은 정규 표현식을 사이에 뭔가 :루비 정규 표현식이 개 문구
hours_and_address_reg = /(?<=<span class="infoTitle">godziny otwarcia: <\/span>).*?(?=<div id="singleOutpostIcons">)/
그래서 내가
<span class="infoTitle">godziny otwarcia: <\/span>
및
<div id="singleOutpostIcons">
그리고 샘플 문서 사이의 모든 텍스트를 얻으려면 (String 변수에 보관함) :
<span class="infoTitle">godziny otwarcia: </span>
pn-pt: <span class="openHours">9.00-17.00</span><br/>
so: <span class="openHours">zamknięte</span><br/>
nd: <span class="openHours">zamknięte</span><br/>
<span class="infoTitle">obsługa kasowa: </span>
pn-pt: <span class="openHours"> 09:00-17:00</span><br/>
so: <span class="openHours"> -</span><br/>
nd: <span class="openHours"> -</span><br/>
<hr class="break-line">
<div id="singleOutpostIcons">
무엇이 문제입니까? 이 정규식이 올바른지, 나는 http://rubular.com/
에 체크하지만 라인
hours_and_address = hours_and_address_reg.match(address_and_hours_box).to_s
puts hours_and_address
아무것도 입력하지 않습니다.
아마도 문제는 중단 선입니까?
결과 plz로 원하는 것을 제공 할 수 있습니까? – dramixx
[Cthulhu 방법을 구문 분석하는 Html] (http://blog.codinghorror.com/parsing-html-the-cthulhu-way/) – Stefan
's' 또는'DOTALL' 플래그 사용 – vks