我有這個源代碼的網站,我想選擇yearid =「10287」從它使用正則表達式。我知道我可以很容易地用JSoup做到這一點,但我只是不想將這個庫添加到我的項目中以實現這一目的。正則表達式到yearid =「10287」從網站源代碼
事實有關yearid = 「10287」
yearid是一個常數,即字母永遠不會改變。
價值變化,它可能是84748或746,但它始終是一個 數
- yearid =「10287」多次出現在源代碼,但我只是 需要單yearid = 「10287」
目前我想這一點:
\s*[yearid]0-9
但它似乎沒有工作。
樣本HTML
//Skipped the meta and header because I don't need it.
...
<body class="sin" yearid="10287" ezaw='580' ezar='400' style='min-height:200px>
<div class="ks">
<div class="wrap">
<div class="content-right-sidebar-wrap">
<main class="content">
//A lot of unneeded tags
<article class="post-1989009 post type-post post" itemscope="" itemtype="http://schema.org/CreativeWork">
<header class="post-header">
<h1 class="post-title" itemprop="headline">Tyh RGB Marco to habits gtr</h1>
<img src="https://ohniee.com/wp-content/uploads/avatars/1/djsy8933e89ufio8389e8-author-img.jpg" class="avatar user-1-avatar avatar-40 photo" width="40" height="40" alt="Profile photo of Johnnie Adams">
<div class="entry-meta" style="padding-top:3px; margin-left: 50px">
" Written by "<a href="/authors/johnnie"><span class="entry-author" itemprop="author" itemscope="" itemtype="http://schema.org/Person"><span class="entry-author-name" itemprop="name">Johnnie Adams</span></span></a> <script>
document.write(" on April 23rd, 2002 11:28 PM")</script>" on April 23rd, 2002 11:28 PM . "<span class="entry-comments-link"><a href="https://johniee.com/2002/04/thalo-in-American-film-industryk.html#comments">1 Comment</a></span>
</div>
</header>
//A lot of unneeded tags
...
謝謝。這固定了它。 – X09
如果我想選擇除'/ yearid =「[0-9] +」/' – X09