Keep the last 5 numbers/Letters

A swapping-ground for Regular Expression syntax

Keep the last 5 numbers/Letters

Postby Jannemann23 » Mon Jun 24, 2013 11:15 am

Hi there,

I already searched around, but I have not found an answer to my problem.
I want to rename 2000 Files, and just keep the last 5 numbers/Letters. The files look like this (no special structure exept the last 5 numbers - always 5):

Before:
asdfasd&asdf.a893 /638 aaaaa_11111.ext
bbbbdfd sdf . asdf _ df 34 $ # bbbbbb_22222.ext
cc_3asd ed3 345455 $&_33333.ext

After:
11111.ext
22222.ext
33333.ext

I hope somebody can give me an answers!!

ps in excel its easy - =right(A1;5) :roll: :D

THANKS!! :D
Jannemann23
 
Posts: 1
Joined: Mon Jun 24, 2013 10:52 am

Re: Keep the last 5 numbers/Letters

Postby Stefan » Wed Jun 26, 2013 6:15 am

Lets see if I can post from this PC. From another I get always "server is busy"

Use
RegEx(1)
Find: (.+)(.{5})
Repl: \2



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

Re: Keep the last 5 numbers/Letters

Postby graniteartisan » Fri Aug 16, 2013 8:27 pm

So, if I wanted to keep only the FIRST six digits of my filenames (BBD302a 24x36.plt) to (BBED302.plt) - how would I do that? It doesn't seem to work - if I follow your expression. Thank you.
graniteartisan
 
Posts: 4
Joined: Fri Aug 16, 2013 8:21 pm

Re: Keep the last 5 numbers/Letters

Postby Stefan » Fri Aug 16, 2013 8:51 pm

graniteartisan wrote:So, if I wanted to keep only the FIRST six digits of my filenames (BBD302a 24x36.plt) to (BBED302.plt) - how would I do that?



Keep the first six signs of any kind, drop the rest of the file name:

Use
RegEx(1)
Find: (.{6})
Repl: \1






Please wait a few seconds then submit. Thank you.
Stefan
 
Posts: 736
Joined: Fri Mar 11, 2005 7:46 pm
Location: Germany, EU

Re: Keep the last 5 numbers/Letters

Postby graniteartisan » Mon Aug 19, 2013 1:12 pm

Thank you! That worked great!
graniteartisan
 
Posts: 4
Joined: Fri Aug 16, 2013 8:21 pm


Return to Regular Expressions