gpt4 book ai didi

php - 最后一点后的正则表达式提取字符串

转载 作者:行者123 更新时间:2023-12-04 15:31:45 24 4
gpt4 key购买 nike

我正在尝试提取上传文件的每个文件扩展名。例如:

example.doc -> .doc

another.example.jpeg -> .jpeg

even.anaother.example.pdf -> .pdf

我知道这可以通过使用正则表达式来解决,但正则表达式对我来说是一本合上的书。所以我需要你的帮助:(拜托

提前致谢!

最佳答案

试试这个正则表达式:

\.[^.]*$

关于php - 最后一点后的正则表达式提取字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7482555/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com