I think I’m pretty close, I’m writing a regex for a partial url.
Please note: my examples show a maximum of two / however it could have else or more. Example /test/test/test.htm
It can accept a-z 0-9 - and . if it has one of the file extensions referenced below. It can't start/end with a - or a . there must be a number or character before and after. Currently my regex is accepting strings which should be rejected
Accepted
/test/test.htm (this could be jpeg|jpg|gif|png|htm|html)
/test/test
/test/test-test.htm
/test/test-test
/test/test123.htm
/test/test123
Should be rejected (but passing)
/test/test.
/test/.hhh
/tes t
/tes_t
/tes"t
/tes’t
/-test (cannot start with any thing else other than letters/numbers
Regex: ^\/.*?(\.(jpeg|jpg|gif|png|htm|html)|([^\.])[\w-]{1})$
