이 행할 수있는 많은 방법이다. 아마 당신이 그것을 원할지도 모르는 이유를 보는 것이 도움이 될 것입니다. 일반적으로 인코딩 된 HTML을 제거하려면 HTML의 내용을 복구하려고합니다. Ruby에는 쉽게 사용할 수있는 모듈이 있습니다.
require 'cgi'
require 'nokogiri'
html = "<div>Hi All,</div><div class=\"paragraph_break\">< /></div><div>Starting today we are initiating PoLS.</div><div class=\"paragraph_break\"><br /></div><div>Please use the following communication protocols:<br /></div><div>1. Task Breakup and allocation - Gravity<br /></div><div>2. All mail communications - BC messages<br /></div><div>3. Reports on PoC/Spikes: Writeboard<br /></div><div>4. Non story related tasks: BC To-Do<br /></div><div>5. All UI and HTML will communicated to you through BC.<br /></div><div>6. For File sharing, we'll be using Dropbox.<br /></div><div>7. Use Skype for lighter and generic desicussions. However, in case you need any approvals, data for later reference, etc, then please use BC. PoLS conversation has been created on skype.</div><div class=\"paragraph_break\"><br /></div><div>You'll have been given necessary accesses to all these portals. Please start using them judiciously.</div><div class=\"paragraph_break\"><br /></div><div>All the best!</div><div class=\"paragraph_break\"><br /></div><div>Thanks,<br /></div><div>Saurav<br /></div>"
puts CGI.unescapeHTML(html)
출력한다 :
<div>Hi All,</div><div class="paragraph_break">< /></div><div>Starting today we are initiating PoLS.</div><div class="paragraph_break"><br /></div><div>Please use the following communication protocols:<br /></div><div>1. Task Breakup and allocation - Gravity<br /></div><div>2. All mail communications - BC messages<br /></div><div>3. Reports on PoC/Spikes: Writeboard<br /></div><div>4. Non story related tasks: BC To-Do<br /></div><div>5. All UI and HTML will communicated to you through BC.<br /></div><div>6. For File sharing, we'll be using Dropbox.<br /></div><div>7. Use Skype for lighter and generic desicussions. However, in case you need any approvals, data for later reference, etc, then please use BC. PoLS conversation has been created on skype.</div><div class="paragraph_break"><br /></div><div>You'll have been given necessary accesses to all these portals. Please start using them judiciously.</div><div class="paragraph_break"><br /></div><div>All the best!</div><div class="paragraph_break"><br /></div><div>Thanks,<br /></div><div>Saurav<br /></div>
나는 모든 텍스트 검색, 단계 더 걸릴 및 태그를 제거하려면 :
puts Nokogiri::HTML(CGI.unescapeHTML(html)).content
윌 출력 :
Hi All,Starting today we are initiating PoLS.Please use the following communication protocols:1. Task Breakup and allocation - Gravity2. All mail communications - BC messages3. Reports on PoC/Spikes: Writeboard4. Non story related tasks: BC To-Do5. All UI and HTML will communicated to you through BC.6. For File sharing, we'll be using Dropbox.7. Use Skype for lighter and generic desicussions. However, in case you need any approvals, data for later reference, etc, then please use BC. PoLS conversation has been created on skype.You'll have been given necessary accesses to all these portals. Please start using them judiciously.All the best!Thanks,Saurav
을
내가 보통 원하는 곳은 어느 곳입니까? 내가 그 종류의 문자열을 볼 때 얻을 수 있습니다.
루비의 CGI은 HTML 인코딩 및 디코딩을 쉽게 만듭니다. Nokogiri 보석을 사용하면 태그를 쉽게 삭제할 수 있습니다.
당신은 무엇을 시도 했습니까? 시도했을 때 무슨 일이 일어 났습니까? –
예상되는 결과를 추가 할 수 있습니까? 당신이 정말로 필요로하는 것을 이해하기가 어렵습니다. 당신이 그들을 제거하거나 그냥 해독 할 것인지 확실하지 않습니다. 일부를 제거하고 다른 사용자를 해독해야합니까? – robertodecurnex