by bgdan » Fri Nov 14, 2014 3:28 pm
Hello and sorry to hijack this thread. I have a kind of similar situation and that's why I post here.
So I need to rename:
FROM:
123456ABCDE123FGH 20141114 Smith, John Lewis
123456ABCDE123FGH 20120203 Mark von Smith, John Lewis
123456ABCDE123FGH 20100109 McDonalds, John M
TO:
123456ABCDE123FGH 20141114 SmithJ
123456ABCDE123FGH 20120203 MarkvonSmithJ
123456ABCDE123FGH 20100109 McDonaldsJ
The "123456ABCDE123FGH" text never changes, it is followed by a space and the date "20141114" (this changes from one file name to another), another space ,"LastName", comma+space, and "First name"
I want the everything until the name to remain unchanged, and the name transformed from "Smith, John Lewis" to "SmithJ".
Meaning I need to remove the comma+space characters and crop the FirstName into just the 1st Letter from the FirstName.
Sometimes the Last Name has spaces (see 2nd example, Mark von Smith), I'm not sure if this makes any difference.
I tried to match using Regex like this:
Match:(123456ABCDE123FGH )(........)( )(.+)(, )(.+)
But I'm lost on how to replace it. I'm not even sure I matched correctly.
Thank you for the help!