0

Right now I'm using (?<=href=")(.*?)(?=#fragment-[0-9]">) which returns anything in between href=" and #fragment-[any number between 0 and 9]" which is basically what I want, but I want to exclude things like href="http://blahblah.com#fragment-1" or href="https:blahblah.com#fragment-1" so what can I change the (.*?) to to exclude strings starting with http or https.

Thanks!

Paidenwaffle
  • 163
  • 1
  • 1
  • 11

1 Answers1

1
(?<=href=")(?!https?:)(.*?)(?=#fragment-[0-9]">)

Also, don't use regex to parse HTML.

Community
  • 1
  • 1
Andrew Clark
  • 192,132
  • 30
  • 260
  • 294