Files name first_last.jpg need flast.jpg

A swapping-ground for Regular Expression syntax

Files name first_last.jpg need flast.jpg

Postby mloraditch » Mon Jul 28, 2014 7:43 pm

Pretty simple, but I am useless with regex, just need to change from first_last.jpg to first initial last name.jpg.
John_doe.jpg, becomes jdoe.jpg.

Thanks for all assistance!
mloraditch
 
Posts: 2
Joined: Mon Jul 28, 2014 7:40 pm

Re: Files name first_last.jpg need flast.jpg

Postby Stefan » Mon Jul 28, 2014 8:10 pm

mloraditch wrote: need to change from first_last.jpg to first initial last name.jpg


FROM:
John_doe.jpg
TO:
jdoe.jpg.

RULE:
Match and store the first sign, drop the rest till and including comma, match and store the rest till the end.

USE:
RegEx(1)
Search: ^(.).+_(.+)$
Replace: \1\2


You may also use the case rule additionally to lower case every char as by your example.


 

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

Re: Files name first_last.jpg need flast.jpg

Postby mloraditch » Mon Jul 28, 2014 10:33 pm

Thanks, that worked perfectly!
mloraditch
 
Posts: 2
Joined: Mon Jul 28, 2014 7:40 pm


Return to Regular Expressions