0

I'm trying to get the regex to extract all numbers located between the / character and the - character in a web address.

ex. https://example.com/myfirstlink/1737-mypage.html Should return 1737

and

https://anotherexample.com/second/536-page456.html Should return 536

Any ideas / suggestions would be very much appreciated.

Lawless Leopard
  • 59
  • 2
  • 10
  • @WiktorStribiżew Actually I have tried a few things but can't get it to work, here's how far I've gotten (?<=\/)([0-9])(?=\-) – Lawless Leopard Sep 04 '20 at 08:54
  • Great, please add it to the question and describe the problem you have with the regex. It looks like you missed `+` after `[0-9]`. See https://regex101.com/r/kbVyrQ/1. See [this thread](https://stackoverflow.com/questions/48253155/regex-to-match-multiple-number-groups-between-two-characters) I re-linked to. – Wiktor Stribiżew Sep 04 '20 at 08:55

0 Answers0