Copy link to clipboard
Copied
I almost have it but have run into a snag that i can't figure out...Hyphenated names
I have to create a index for a directory
I have pulled all the names using "create table of content" from the document that use a certain paragraph style
in the directory they are listed last, first but here they want first, last so i made a find replace using greps that flips them
FIND ^(\w+), (\w+)([.\w]+)?
REPLACE $2$3 $1
works fine for Rudy, Scott M
but fails on Rudy-Goon, Scott M
when it fails it does nothings it would look like the list on the right below after i run it
Rudy, Scott M Scott M Rudy
Rudy-Goon,Scott M Rudy-Goon,Scott M
Doe, John S John S Doe
Public, John Q John Q Public
any suggestions?
thanks in advance!!!!
scott
Try ^([-\w]+), ([-\w+])([-.\w]+)?
Note you have a typo and are missing the space in after the "," in the problematic line, so the above grep won't work either unless you add the space.
HTH
Trevor
Copy link to clipboard
Copied
Try ^([-\w]+), ([-\w+])([-.\w]+)?
Note you have a typo and are missing the space in after the "," in the problematic line, so the above grep won't work either unless you add the space.
HTH
Trevor
Copy link to clipboard
Copied
Maybe this one helps you:
find: ^((\w+)(-\w+)?), ?(\w+ \w)
change to: $4 $1
I've added " ?" after comma if this kind of typos that Trevor mentioned are more frequent.
Cheers,jf
Copy link to clipboard
Copied
Just another approach...
Copy link to clipboard
Copied
Thank you all for the help...You all make it look so easy to do this and it seems so obvious AFTER i see the answer--like a good riddle
Copy link to clipboard
Copied
Wonderful!!!!
Copy link to clipboard
Copied
Does anyone know how to change firstname_lastname to lastname, firstname?
Copy link to clipboard
Copied
Does anyone know how to change firstname_lastname to lastname, firstname?
Copy link to clipboard
Copied
That would be
Find: (.+?)_(.+)
Change to: $2, $1
If this does not work for you, post a new question and include examples.
Copy link to clipboard
Copied
How do you change lastname, firstname to firstname lastname
None of the above are helping me?
Copy link to clipboard
Copied
winterm's reponse of 30 Dec. 2016 should do it. Did you try that one?