i have problem . i want to find out the url form acnchor tag which consist "title" tag in anchor tag.
example:
<a href="http://www.test.com" title="xyz">this is test</a>
how can i match the string and fetch url using regular expression.
thanks
<a\\s+([^>]*)href="(https?:\\/\\/([^"]*))"\\s+([^>]*)title="xyz"(.*?)>(.*?)<\\/a>
您可以通过部分匹配$2
获得网址,您可以在此处尝试
老实说,我将使用HTML解析库来获取href
属性的内容。
/href="(.*?)(?=".*?title)/
you will have to trim the href="
from the beginning of the match
/abc(?=xyz)/
positive lookahead -> matches abc
if abc
is followed by xyz
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.