It is currently March 28th, 2024, 5:48 pm

Remove extension from filename

Get help with creating, editing & fixing problems with skins
Post Reply
ronnymees
Posts: 6
Joined: July 19th, 2017, 5:56 pm

Remove extension from filename

Post by ronnymees »

Hello,

I need to remove the extension from the filename.

I tried with this, but it won't work.
I still get the full filename.

Any suggestions ?

Code: Select all

[MeasureAppName1]
Measure=Plugin
Plugin=FileView
Path=[MeasureAppsFolder]
Type=FileName
Index=1
RegExpSubstitute=1
Substitute="^(.{1,}) . (.{1,})+$" : "\1"
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Remove extension from filename

Post by balala »

ronnymees wrote:I need to remove the extension from the filename.

I tried with this, but it won't work.
I still get the full filename.

Any suggestions ?
In the posted Substitute option, the first (.{1,}) expression should have to mean the name of the file and the second one, its extension. The .{1,} means that the name of the file should have to have from one character up to how many? You didn't add the second number, which would be the upper limit of the number of letters. But you don't even have to, .* means any number of letters.
The dot (.) which separates the file name and extension is a reserved character in regular expressions and you have to escape it, through a backslash (\).
And finally there are two, probably unneeded spaces, before and after the dot.
Taking into account all these, try the following Substitute option: Substitute="^(.*)\.(.*)$":"\1".
Post Reply