对正则表达式完全陌生。希望以前没有回答过这个问题。抱歉,如果有。
我的问题是尝试从字符串中的字符串中获取名称。不确定我是否已经为这个最好的选择感到困惑。这是从总字符串块中提取的一小部分
<div class="txt-block" itemprop="contractors" itemscope
itemtype="home">
<h4 class="inline">Employs:</h4> <a href="/.../" itemprop='url'><span class="itemprop"
itemprop="name">Carp 1</span></a>, <a href="/.../"
itemprop='url'><span class="itemprop" itemprop="name">Carp
2</span></a>, <a href="/.../" itemprop='url'><span class="itemprop"
itemprop="name">Carp 3</span></a> <span
class="tots">|</span>
<span class="see-more inline"> <a href="/.../" itemprop='url'>See full options</a>
</span>
</div>
我想提取“鲤鱼 1”、“鲤鱼 2”、“鲤鱼 3”。字符串长度因我要提取的项目数量而异。
也许还有更简单的方法可以做到这一点。感谢所有帮助。