I've got a list of names that I want to word swap. I have last name first, no comma in between, then first name. I did it this way to make alphabetizing it easy. What I want to do now is put the first name in front.
I've tried a zillion different Regular Expressions to get:
Jones Bob
Smith Mike
to change to:
Bob Jones
Mike Smith
but the mojo evades me. I've tried:
^\(\<.*\>\)\(?\)\(\<.*\>\)\n
^\(\[:word:]\)\(?\)\(\[:word:]\)\n
to use the replacement expression of \3\2\1\n
but I can't seem to get anything to work. I did get one or two combos that would work on the first couple of names, but after that it started garbling up names.
Any suggestions would be welcome.
Thanks!
Problem with RegEx
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
figured it out...
Find: \(^[[:word:]]+\)\([[:space:]]+\)\([[:word:]]+\)$
Repalce: \3\2\1
works like a champ, start at top of file, click replace all, bam! Time to go to sleep!
Repalce: \3\2\1
works like a champ, start at top of file, click replace all, bam! Time to go to sleep!
Search for
replace by
Explanation:
start of line
remember stuff inside for replacement expression
search for everything but a space
at least one of whatever is before...
end of line
Code: Select all
^\([^ ]+\) \([^ ]+\)$Code: Select all
\2 \1Code: Select all
^Code: Select all
\(\)Code: Select all
[^ ]Code: Select all
+Code: Select all
$