Problem with RegEx
Posted: Mon May 19, 2003 7:51 am
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!
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!