私はこのウェブサイトのソースコードを持っており、正規表現を使用してyearid = "10287"を選択します。私はJSoupで簡単にそれを行うことができますが、この唯一の目的のために私のプロジェクトにライブラリを追加したくありません。 yearid = "10287"Regex to yearid = "10287"ウェブサイトのソースコード
について
な事実yearidは決して変わらない手紙すなわち一定です。
値は、それが84748または746かもしれないが、変化するが、それは常に「10287」は、一度ソースコード内に複数表示されますが、私はちょうど 必要= 数
- yearidです単一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