开发者

Regex to match all characters before file extension

开发者 https://www.devze.com 2023-02-06 04:03 出处:网络
I\'m using this Windows a开发者_如何学Cpplication to batch rename a bunch of images. The application supports Regex, so I\'m looking for an expression that will match everything (letters, numbers, hyp

I'm using this Windows a开发者_如何学Cpplication to batch rename a bunch of images. The application supports Regex, so I'm looking for an expression that will match everything (letters, numbers, hyphens, anything) before my file extension.

Thanks!


Not quite enough information given in the question, but this is probably what you want:

([^/\\]+)(\.[^/\\]+?)?

The first capture group will contain your file's basename and the second capture group will contain the extension, including the '.' character, if it exists.

You can reference the two capture groups in the 'Replace' section with $1 and $2.

0

精彩评论

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