나는이 웹 사이트의 소스 코드를 가지고 있으며, 정규식을 사용하여 yearid = "10287"을 선택하고 싶습니다. 내가 JSoup로 쉽게 할 수 있다는 것을 알고 있지만이 유일한 목적으로 프로젝트에 라이브러리를 추가하고 싶지는 않습니다.정규식에서 yearid = "10287"웹 사이트 소스 코드
현황에 대한 yearid = "10287"
yearid는 문자 변경하지 않을 즉 상수이다.
10,287이 다릅니다 값은, 그것은 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