How to write regular matching for such URL?

need to match:

https://www.example.com
https://www.example.com/demo
https://www.example.com/demo/abc
https://www.example.com/demo/abc/123.html ()

mismatch:

https://www.example.com/demo/abc/efg123.html 

Click to view the matching result

can also be written


/^https:\/\/www\.example\.com(\/[a-z]+(\/[a-z]+(\/\d+\.html)?)?)?$/

/^https:\/\/www\.example\.com(\/[a-z]+(\/[a-z]+(\/\d+\.html)?)?)?$/

can't match
@ yuanxiaowa

Menu