开发者

ColdFusion REGEX - to determine the file's extension

开发者 https://www.devze.com 2023-01-09 00:14 出处:网络
I\'m looking for a REGEX to obtain a files extension. Given examples like: modocument.doc modocument.docx

I'm looking for a REGEX to obtain a files extension.

Given examples like:

modocument.doc
modocument.docx
dasddsa.pdf
kdsksdklsadklasdklads.png
ads123.jpg

I need a REGEX that provides the 3-4 char extension, but isn't fooled 开发者_开发技巧by things like:

asdadsasdads.jpg.png

And only gets PNG as seen above.


I think ListLast would do a better job for you:

<cfset FileExt=ListLast(YourFilename,".")>
0

精彩评论

暂无评论...
验证码 换一张
取 消