Remove Everything After *jpg*

A swapping-ground for Regular Expression syntax

Remove Everything After *jpg*

Postby swingking03 » Mon Feb 05, 2024 8:38 pm

How do I remove everything after .jpg?

I have tried cropping with Remove(5) and RegEx
Code: Select all
Match: (.*?)The.*
but can't get anything to work


Example file:
001_15914895.jpg_v=1&k=default&t=1707019200&p=1&s=ABwzLJKbf64G6kRktEVbqSIO_HaAaKF8zAEUmAznDfo
swingking03
 
Posts: 8
Joined: Thu May 12, 2022 2:22 am

Re: Remove Everything After *jpg*

Postby Admin » Tue Feb 06, 2024 5:18 am

Hi, is .jpg part of the extension? In the Renaming menu
File/Folder Extensions > Rename File Extensions as Being Part of the File Name
With this option selected, the file name extensions will be ignored and your renaming operations will always affect the entire file name. Use this option with great care, as Windows relies on the file name extension to decide what to do with a file.
Admin
Site Admin
 
Posts: 2354
Joined: Tue Mar 08, 2005 8:39 pm

Rename extensions starting with .jpg

Postby Luuk » Tue Feb 06, 2024 10:01 am

After putting the checkmark inside for "Renaming Options, File/Folder Extensions, Rename File Extensions".
Then RegEx(1) could probably just use a "Match" and "Replace" something like...
(.+\.jpg)
\1

But with any names like start.jpg-middle-end.mp4, its much safer with something like...
(.+\.jpg)[^.]+$
\1
Luuk
 
Posts: 705
Joined: Fri Feb 21, 2020 10:58 pm


Return to Regular Expressions


cron