2011-10-14 46 views
0

大家好我有一些問題要用正則表達式來抓取電影標題。用正則表達式抓取一些文本

我怎麼能搶

<title>არ დანებდე 2/Никогда не сдавайся 2/Never Back Down 2</title> 

正則表達式的標題標籤之間的文本,請幫助我。

+0

你所需要的所有電影標題翻譯或僅僅是英語嗎? –

+0

我需要所有的電影標題標籤 – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/640549/">Shark</a></span> <span></span> </small> </span> </p> </div> </div> </div> </div> </div> </article> </div> <div class="answer-title"> <span class="text-logo margin-top-sm">A</span> <h2 class="title h4">回答</h2> </div> <div class="item-description text-md markdown-body margin-bottom-40 voidso"> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">3<i class="fa fa-thumbs-up"></i></span> <i class="fa fa-check fa-2x"></i> </div> <div class="post-offset"> <div class="answer fmt"> <p>對於PHP使用</p> <pre><code class="prettyprint-override">preg_match('@<title>([^<]+)</title>@', $yourTitleText, $m); echo $m[1]; </code></pre> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/7764940">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2011-10-14 08:24:37</span> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/559338/">akhilless</a></span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> <!-- comments --> <div class="comments"> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">謝謝這個答案解決了我的問題 – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/640549/">Shark</a></span> <span></span> </small> </span> </p> </div> </div> </div> </div> </div> </article> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1038284119" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">2<i class="fa fa-thumbs-up"></i></span> </div> <div class="post-offset"> <div class="answer fmt"> <p>這是C#風格的正則表達式</p> <pre><code class="prettyprint-override"><title[^>]*>(?<Title>[^<]*)</title </code></pre> <p>一個版本,你使用哪種語言?</p> <p>對於PHP,akhilless是正確的:</p> <pre><code class="prettyprint-override">preg_match('@<title>([^<]+)</title>@', $yourTitleText, $m); echo $m[1]; </code></pre> <p>作品。</p> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/7764921">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2011-10-14 08:23:01</span> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/795296/">Soony</a></span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> <!-- comments --> <div class="comments"> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">我使用PHP和這個表達式沒有工作:( – <span class="text-secondary"> <small> <a rel="noopener" target="_blank" href="https://stackoverflow.com/users/640549/">Shark</a></span> <span></span> </small> </span> </p> </div> </div> </div> </div> </div> </article> </div> <div class="clearfix"> </div> <div class="relative-box"> <div class="relative">相關問題</div> <ul class="relative_list"> <li> 1. <a href="http://hk.uwenku.com/question/p-npovpigo-bch.html" target="_blank" title="在Java中使用正則表達式抓取文本標題"> 在Java中使用正則表達式抓取文本標題 </a> </li> <li> 2. <a href="http://hk.uwenku.com/question/p-xemyvgww-rr.html" target="_blank" title="一些基本的正則表達式"> 一些基本的正則表達式 </a> </li> <li> 3. <a href="http://hk.uwenku.com/question/p-aarwwhyr-gd.html" target="_blank" title="內部抓取件。*?正則表達式"> 內部抓取件。*?正則表達式 </a> </li> <li> 4. <a href="http://hk.uwenku.com/question/p-nbjoavml-vd.html" target="_blank" title="正則表達式只抓取日期"> 正則表達式只抓取日期 </a> </li> <li> 5. <a href="http://hk.uwenku.com/question/p-kqiwlroj-hd.html" target="_blank" title="抓取Scrapy的URL正則表達式"> 抓取Scrapy的URL正則表達式 </a> </li> <li> 6. <a href="http://hk.uwenku.com/question/p-ukgjpume-xt.html" target="_blank" title="正則表達式基址URL抓取"> 正則表達式基址URL抓取 </a> </li> <li> 7. <a href="http://hk.uwenku.com/question/p-axawwyar-bku.html" target="_blank" title="頁面抓取的正則表達式"> 頁面抓取的正則表達式 </a> </li> <li> 8. <a href="http://hk.uwenku.com/question/p-vpzsmckp-da.html" target="_blank" title="數據抓取的正則表達式?"> 數據抓取的正則表達式? </a> </li> <li> 9. <a href="http://hk.uwenku.com/question/p-zapfuqcq-bb.html" target="_blank" title="抓取正則表達式的部分"> 抓取正則表達式的部分 </a> </li> <li> 10. <a href="http://hk.uwenku.com/question/p-mtfxzzvd-ym.html" target="_blank" title="正則表達式來抓取參數"> 正則表達式來抓取參數 </a> </li> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-6208739752673518" data-ad-slot="4606349252"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <li> 11. <a href="http://hk.uwenku.com/question/p-ymcnbkvi-re.html" target="_blank" title="正則表達式:如何提取一些字段文本"> 正則表達式:如何提取一些字段文本 </a> </li> <li> 12. <a href="http://hk.uwenku.com/question/p-njdusjki-eh.html" target="_blank" title="用正則表達式文本提取"> 用正則表達式文本提取 </a> </li> <li> 13. <a href="http://hk.uwenku.com/question/p-arfotgqr-ca.html" target="_blank" title="用正則表達式提取文本「,」"> 用正則表達式提取文本「,」 </a> </li> <li> 14. <a href="http://hk.uwenku.com/question/p-fuxhspnh-qg.html" target="_blank" title="正則表達式來抓取類似文本中的值"> 正則表達式來抓取類似文本中的值 </a> </li> <li> 15. <a href="http://hk.uwenku.com/question/p-zgnjtoda-xg.html" target="_blank" title="正則表達式python - 抓文件名"> 正則表達式python - 抓文件名 </a> </li> <li> 16. <a href="http://hk.uwenku.com/question/p-rklfvpnk-po.html" target="_blank" title="[正則表達式]爲一些正則表達式大於10000"> [正則表達式]爲一些正則表達式大於10000 </a> </li> <li> 17. <a href="http://hk.uwenku.com/question/p-wcouixws-beo.html" target="_blank" title="使用c#中的正則表達式去除一些文本#"> 使用c#中的正則表達式去除一些文本# </a> </li> <li> 18. <a href="http://hk.uwenku.com/question/p-nrcvsead-bgu.html" target="_blank" title="正則表達式中提取文本"> 正則表達式中提取文本 </a> </li> <li> 19. <a href="http://hk.uwenku.com/question/p-baehyvdg-gs.html" target="_blank" title="正則表達式獲取文本"> 正則表達式獲取文本 </a> </li> <li> 20. <a href="http://hk.uwenku.com/question/p-vnvggwax-zr.html" target="_blank" title="Mysql文本提取正則表達式"> Mysql文本提取正則表達式 </a> </li> <li> 21. <a href="http://hk.uwenku.com/question/p-wudcauuz-mm.html" target="_blank" title="文本提取的正則表達式"> 文本提取的正則表達式 </a> </li> <li> 22. <a href="http://hk.uwenku.com/question/p-ytodayuj-ss.html" target="_blank" title="提取文本的正則表達式"> 提取文本的正則表達式 </a> </li> <li> 23. <a href="http://hk.uwenku.com/question/p-soaxjthj-bcq.html" target="_blank" title="正則表達式:文本"> 正則表達式:文本 </a> </li> <li> 24. <a href="http://hk.uwenku.com/question/p-gjqexxnx-bbc.html" target="_blank" title="正則表達式提取器中必須使用哪些正則表達式?"> 正則表達式提取器中必須使用哪些正則表達式? </a> </li> <li> 25. <a href="http://hk.uwenku.com/question/p-sjiviokr-bmb.html" target="_blank" title="使用正則表達式提取一些模式"> 使用正則表達式提取一些模式 </a> </li> <li> 26. <a href="http://hk.uwenku.com/question/p-npnkogxm-up.html" target="_blank" title="使用正則表達式來抓取多行之間的文本"> 使用正則表達式來抓取多行之間的文本 </a> </li> <li> 27. <a href="http://hk.uwenku.com/question/p-kxwtdmip-ha.html" target="_blank" title="一些自定義文本的正則表達式"> 一些自定義文本的正則表達式 </a> </li> <li> 28. <a href="http://hk.uwenku.com/question/p-udvharuw-bhy.html" target="_blank" title="正則表達式匹配不包含一些文本"> 正則表達式匹配不包含一些文本 </a> </li> <li> 29. <a href="http://hk.uwenku.com/question/p-kktnnifv-bhx.html" target="_blank" title="正則表達式PCRE刪除一些文本"> 正則表達式PCRE刪除一些文本 </a> </li> <li> 30. <a href="http://hk.uwenku.com/question/p-vjaaoubs-mm.html" target="_blank" title="正則表達式刪除一些文本"> 正則表達式刪除一些文本 </a> </li> </ul> </div> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1575177025"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="padding-top-10"></div> </div> </div> <script type="text/javascript" src="http://img.uwenku.com/uwenku/script/side.js?t=1644592048261"></script> <script type="text/javascript" src="http://img.uwenku.com/uwenku/plugin/highlight/highlight.pack.js"></script> <link href="http://img.uwenku.com/uwenku/plugin/highlight/styles/docco.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $('pre').each(function(i, e) { hljs.highlightBlock(e, "<span class='indent'> </span>", false) }); </script> <div class="col-lg-3 col-md-4 col-sm-5"> <div id="rightTop"> <div class="row"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="5415218910" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="row sidebar panel panel-default"> <div class="panel-heading font-bold"> 最新問題 </div> <div class="m-b-sm m-t-sm clearfix"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-yxiqoflb-bu.html" target="_blank" title="FIFO與/ dev/urandom"> FIFO與/ dev/urandom </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-whezobpa-cp.html" target="_blank" title="將劇情保存爲EMF文件"> 將劇情保存爲EMF文件 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-nffmqfzm-hb.html" target="_blank" title="如何從SNMP MIB獲取ifOperStatus?"> 如何從SNMP MIB獲取ifOperStatus? </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-vrrebkhm-kr.html" target="_blank" title="在同一個表列中選擇重複的記錄並將它們列出"> 在同一個表列中選擇重複的記錄並將它們列出 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-xzagrdwt-hw.html" target="_blank" title="如何傳遞一個變量在web API"> 如何傳遞一個變量在web API </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-keloufdr-eb.html" target="_blank" title="LendingClub.com API內部服務器在二級市場上購買票據的錯誤"> LendingClub.com API內部服務器在二級市場上購買票據的錯誤 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-golxqduv-gs.html" target="_blank" title="TCP/IP數據包中的端口號"> TCP/IP數據包中的端口號 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-fwrwoodx-ex.html" target="_blank" title="模擬Angular 2中的長響應"> 模擬Angular 2中的長響應 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-bcntqxlt-z.html" target="_blank" title="如何在QSplitter中設置QTreeView的初始大小?"> 如何在QSplitter中設置QTreeView的初始大小? </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-wjcpqafr-d.html" target="_blank" title="打印響應部分完成Python的異步事件循環,同時還完成任務的響應"> 打印響應部分完成Python的異步事件循環,同時還完成任務的響應 </a> </li> </ul> </div> </div> </div> <p class="article-nav-bar"></p> <div class="row sidebar article-nav"> <div class="row box_white visible-sm visible-md visible-lg margin-zero"> <div class="top"> <h3 class="title"><i class="glyphicon glyphicon-th-list"></i> 相關問題</h3> </div> <div class="article-relative-content"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-npovpigo-bch.html" target="_blank" title="在Java中使用正則表達式抓取文本標題"> 在Java中使用正則表達式抓取文本標題 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-xemyvgww-rr.html" target="_blank" title="一些基本的正則表達式"> 一些基本的正則表達式 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-aarwwhyr-gd.html" target="_blank" title="內部抓取件。*?正則表達式"> 內部抓取件。*?正則表達式 </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-nbjoavml-vd.html" target="_blank" title="正則表達式只抓取日期"> 正則表達式只抓取日期 </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-kqiwlroj-hd.html" target="_blank" title="抓取Scrapy的URL正則表達式"> 抓取Scrapy的URL正則表達式 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-ukgjpume-xt.html" target="_blank" title="正則表達式基址URL抓取"> 正則表達式基址URL抓取 </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-axawwyar-bku.html" target="_blank" title="頁面抓取的正則表達式"> 頁面抓取的正則表達式 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-vpzsmckp-da.html" target="_blank" title="數據抓取的正則表達式?"> 數據抓取的正則表達式? </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-zapfuqcq-bb.html" target="_blank" title="抓取正則表達式的部分"> 抓取正則表達式的部分 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-mtfxzzvd-ym.html" target="_blank" title="正則表達式來抓取參數"> 正則表達式來抓取參數 </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div><!-- wrap end--> <!-- footer --> <footer id="footer"> <div class="bg-simple lt"> <div class="container"> <div class="row padder-v m-t"> <div class="col-xs-8"> <ul class="list-inline"> <li><a href="http://hk.uwenku.com/contact">聯系我們</a></li> <li>© 2020 HK.UWENKU.COM</li> <li><a target="_blank" href="https://beian.miit.gov.cn/">沪ICP备13005482号-4</a></li> <li><script type="text/javascript" src="https://v1.cnzz.com/z_stat.php?id=1280101193&web_id=1280101193"></script></li> <li><a href="http://www.uwenku.com/" target="_blank" title="优文库">简体中文</a></li> <li><a href="http://hk.uwenku.com/" target="_blank" title="優文庫">繁體中文</a></li> <li><a href="http://ru.uwenku.com/" target="_blank" title="поле вопросов и ответов">Русский</a></li> <li><a href="http://de.uwenku.com/" target="_blank" title="Frage - und - antwort - Park">Deutsch</a></li> <li><a href="http://es.uwenku.com/" target="_blank" title="Preguntas y respuestas">Español</a></li> <li><a href="http://hi.uwenku.com/" target="_blank" title="कार्यक्रम प्रश्न और उत्तर पार्क">हिन्दी</a></li> <li><a href="http://it.uwenku.com/" target="_blank" title="IL Programma di chiedere Park">Italiano</a></li> <li><a href="http://ja.uwenku.com/" target="_blank" title="プログラム問答園区">日本語</a></li> <li><a href="http://ko.uwenku.com/" target="_blank" title="프로그램 문답 단지">한국어</a></li> <li><a href="http://pl.uwenku.com/" target="_blank" title="program o park">Polski</a></li> <li><a href="http://tr.uwenku.com/" target="_blank" title="Program soru ve cevap parkı">Türkçe</a></li> <li><a href="http://vi.uwenku.com/" target="_blank" title="Đáp ứng viên">Tiếng Việt</a></li> <li><a href="http://fr.uwenku.com/" target="_blank" title="Programme interrogation Park">Française</a></li> </ul> </div> </div> </div> </div> </div> </footer> <!-- / footer --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f78a970f17b19a79fc477a3378096f29"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </body> </html>