php - regex detect any string with no extension at the end -
there string ending this:
test/15-test
how exclude strings have extension @ end. one:
test/15-test.jpg
and select one's no extension @ end.
this pattern not working
^[a-za-z0-9\/-]+\/[0-9]+-*(?!(\.(\w)).)$
and string after number can contain utf-8 characters.
example:
test/14-تست
you can use:
/[\p{l}\p{n}\/-]+\/[0-9]+-[\p{l}\p{n}_]+$/u
or
/[\p{l}\p{n}\/-]+\/[0-9]+-[^.]+$/u
Comments
Post a Comment