ive got several lines that all start with the same word, for example:
Noun: stratum (strata)
1. One of several parallel...
Noun: culvert
1. A transverse and totally... etc.
what i want to do is move the first word(noun in this case) to the end of the first line, placing it behind "(strata)" in the first example and behind "culvert" in the second. is that even possible with regular expressions or should i look around for other solutions?
moving words to end of line
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Are you interested only in lines beginning with the text Noun: ? Then this might do it:
These assume you are using Posix regular expression syntax:
Or are you interested in all lines beginning with a word followed by a colon? Then this might be a good starting point:Find what: ^Noun: (.*)
Replace with: \1 Noun
[X] Regular expression
The parentheses in the regular expressions capture and number subexpressions of the matched text, and the back-slashed numbers in the replacement expressions are place-holders for those captured and numbered subexpressions. So text can be reordered by the judicious capture of subexpressions and ordering of their place-holders.Find what: ^([a-z]+): (.*)
Replace with: \2 \1
[X] Regular expression
These assume you are using Posix regular expression syntax:
Configuration | Preferences | Editor
[X] Use POSIX regular expression syntax
-
- Posts: 13
- Joined: Thu Sep 29, 2005 6:53 am