ColdFusion REGEX - 确定文件的扩展名

Woz*_*Poz 3 regex coldfusion

我正在寻找一个REGEX来获取文件扩展名.

举个例子:

modocument.doc
modocument.docx
dasddsa.pdf
kdsksdklsadklasdklads.png
ads123.jpg
Run Code Online (Sandbox Code Playgroud)

我需要一个提供3-4个字符扩展名的REGEX,但不会被以下内容所欺骗:

asdadsasdads.jpg.png
Run Code Online (Sandbox Code Playgroud)

并且只能获得如上所示的PNG.

Ger*_*der 20

我认为ListLast会为你做得更好:

<cfset FileExt=ListLast(YourFilename,".")>
Run Code Online (Sandbox Code Playgroud)

  • 这也比使用正则表达式快得多. (4认同)
  • 请务必记住文件甚至有扩展名. (3认同)