0

I'm trying to get the digits from a url with an optional ending

/^\/course\/(\d+)\/view/

The /view part is optional.

I've tried various combinations of (..)? around it but can't get it to work.

Any help appriciated.

beek
  • 3,522
  • 8
  • 33
  • 86
  • @blex works perfect please can you make it an anwser – beek Mar 17 '20 at 21:25
  • neither of those answers helped answer my question. @blex had a much better answer - /^\/course\/(\d+)(?=(\/view)?)/, which worked perfectly. While the question is generic, the answer is specific and should remain. – beek Mar 17 '20 at 21:34

0 Answers0