Home > Software engineering >  trying to remove everything after the "second" dot
trying to remove everything after the "second" dot

Time:04-08

Currently i can remove the filename from 123.abc123.ext to "123" with \..*$.But cant just remove the extension like:"123.abc123"

Longer story:

I am using "path copy copy", (a right click menu/windows explorer utility which allows copying files and paths) and it has a regex area with "replace" and ignore case options.

so i find thousands of files with windows file search, right click the results and copy their filenames, save them to a text file and move with a vbscript. there are variances between extension lenghts so i need a variable that will catch everything after the second dot so would love know a broader identifier that will catch the .7z or .JpEg types.

CodePudding user response:

To do this via a regex replacement, do a search on the following pattern:

\.[^.] $

and then replace with empty string. Here is a demo.

To do this via a regex match, use:

.*(?=\.[^.] $)

Demo

  • Related