I tried the pattern below with a lot of variations of (
)
and [
]
but I couldn't achieved my aim.
$pattern = '/^http:\/\/www.mydomain.p.ht\/?[\p{L}\p{N}\-]{0,36}\/?[\p{L}\p{N}\-]{0,51}\/?[\p{L}\p{N}\-]{0,101}$/';
My aim is: to match my needed url structure
http://www.mydomain.p.ht
- 0 or 1
/
slash character - utf-8 aware letters, numbers and dash character. Total length is min 0, max 36
- 0 or 1
/
slash character - utf-8 aware letters, numbers and dash character. Total length is min 0, max 51
- 0 or 1
/
slash character - utf-8 aware letters, numbers and dash character. Total length is min
0, max 101. there mustn't exist
/
slash character at the very end.
currently http://www.mydomain.p.ht/1234561-234561234561234-56123456123456şğ
matches but it shouldn't since 1234561-234561234561234-56123456123456şğ
part has more than 36 characters.
Can you please correct my pattern?