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

Popular posts from this blog

apache - setting document root in antoher partition on ubuntu -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -