Regex to remove "%xx" in filenames

A swapping-ground for Regular Expression syntax

Regex to remove "%xx" in filenames

Postby Eepoonioo » Mon Sep 22, 2014 4:51 am

Hi, I have filenames which have "%xx" in them, for example:

Client Report %E2%84%A2 %5BVerified%5D.doc

Is there a simple method to remove all occurrences of "%xx"?
(That is, the "%" sign plus the following 2 characters)

I have tried the regex "%.." which works in Regex Buddy (see below) but doesn't work in BRU.

Image

BRU:
Image

Thanks!
Eepoonioo
 
Posts: 4
Joined: Mon Sep 22, 2014 4:43 am

remove Percent-encoding URL encoding URL decoding

Postby Stefan » Mon Sep 22, 2014 7:21 am

With BRU regex engine you have to match the whole file name, not parts only.

Match: (.+)%..(.+)
Replace: \1\2

And then perhaps do this more than once.

- - -



To remove this URL Encoding you can try BRUs' Character Translations
See http://www.bulkrenameutility.co.uk/forum/viewtopic.php?f=4&t=1329&p=3705

%,E,2=
%,8,4=
%,A,2=
%,5,B=
%,5,D=
...

Or even decode:
%,5,B=[
%,5,D=]
...



 
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Regex to remove "%xx" in filenames

Postby Eepoonioo » Mon Sep 22, 2014 7:27 am

> With BRU regex engine you have to match the whole file name, not parts only.

OMG really? I suspected that, but didn't think anyone would make things so needlessly complicated. :(

In fact that runs counter to every other regex replace function I've seen in programming languages, like JavaScript, .NET, PHP... if you want to replace a part of a string, all you should need to do is *match that part of the string you want to replace*.

I'm afraid this makes BRU too difficult to use for regex renaming; I'll try to find another app. Please consider implementing a standard form of regex replace, where you only need to match the part(s) you want to replace, not the entire string. It should be easy to do so, since that's how regex programming objects usually work. :)
Eepoonioo
 
Posts: 4
Joined: Mon Sep 22, 2014 4:43 am


Return to Regular Expressions