0

I have this string:

<a href="..">..</a></td><a href="Example.pdf">Example.pdf</a>

I would like to get all the links and I do so with this regular expression:

href=\"([^/]*?)\"

However, I would like the regular expression to ignore this specific string:

..

How would I modify my regular expression to achieve this exclusion?

Cœur
  • 37,241
  • 25
  • 195
  • 267
etayluz
  • 15,920
  • 23
  • 106
  • 151

1 Answers1

0

This one based on a negative lookahead should work : <a.+?href=["'](?!\.\.)([^"']+)["'].*?>(.+?)<\/a>

Use Group 1 to extract link of each match

Demo

Stephane Janicaud
  • 3,531
  • 1
  • 12
  • 18