[英]Everything before second occurrence of -
I am trying to use Power Rename (within Power Toys from Microsoft) to rename a large number of files.我正在尝试使用 Power Rename(在 Microsoft 的 Power Toys 中)重命名大量文件。 I need to remove everything after the second occurrence of a - and keep the file extension of.pdf at the end.
我需要在第二次出现 - 之后删除所有内容,并在最后保留文件扩展名.pdf。 In other words, I want to only keep what is before the second - and the file extension of.pdf at the end
换句话说,我只想保留第二个之前的内容 - 以及最后的文件扩展名.pdf
Here are three examples:以下是三个例子:
Tab 3-3-zo.pdf选项卡 3-3-zo.pdf
Should be Tab 3-3.pdf应该是 Tab 3-3.pdf
Tab 2-3-jk2.pdf选项卡 2-3-jk2.pdf
Should be: Tab 2-3.pdf应该是:选项卡 2-3.pdf
Tab 3-3-Yuwk-3-kls.pdf选项卡 3-3-Yuwk-3-kls.pdf
Should be: Tab 3-3.pdf应该是:Tab 3-3.pdf
I am having significant trouble trying to figure this out.我在试图弄清楚这一点时遇到了很大的麻烦。 Any help appreciated:)
任何帮助表示赞赏:)
You can use您可以使用
/^([^-\n]*-[^=\n]*)-.*$/
If you want to capture the extension:如果要捕获扩展名:
/^([^-\n]*-[^=\n]*)-.*?(\.\w+)$/
If you only want to match .pdf
files (including .PDF
):如果只想匹配
.pdf
文件(包括.PDF
):
/^([^-\n]*-[^=\n]*)-.*?(?i)(\.pdf)$/
It is super unclear in your question, but you may mean this:您的问题非常不清楚,但您的意思可能是这样的:
/^([^-\n]*-).*?(?i)(\.pdf)$/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.