On 9/16/2006, Michael Heth said:

Is there something that will always take the last "word" is a line and make it 
the first?

Gotta be careful when you say "word" when you ask for Grep help, but your examples made clear what you want.

The following will do what you want:

Search For: ^(.+?) ([^ \r]+)$

Replace With: \2 \1

Everything up to (but not including) the last space is the first match group, everything after the last space up to the end of the line is the second match group. So the replace pattern just replaces the whole line with the second match group, a space, and the first match group.

There are other ways it could be done, and I'm sure at least three other people will send them to you, and at least one of them will then say, "oops, I should have looked ahead...". ;-)

Anyway, hope this helps!

Seth


--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to