我正在尝试获取 PostgreSQL 中的文件路径。
我认为正则表达式可能是最好的解决方案,但我不知道如何编写这些
我拥有的
\\spfs1\stone\foo.txt
我想要的是
foo
假设您实际上不知道路径深度和您要查找的所有文件名以 '.txt' 结尾,以下应该得到您想要的。
with parm(stg) as (select '\\spfs1\stone\foo.txt'::text)
select stg, substring(stg from '.*\\(.*)\.txt$') from parm;
模式的作用:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句