Hi Forum
I have a replacing problem. Say, that I have a text file, that occasionally contains sections similar to this below:
/COM, REAL 1
Mat, 1
R, 2
I would like to replace the number 2 in the last line (R, 2), with the number 1 obtained in from the first line after the text REAL 1, i.e. after the replacing it should appear as:
/COM, REAL 1
Mat, 1
R, 1
Is that kind of replacing be possible in TextPad?
Any help on the topic would be very much appreciated.
Kristjan
Replace a text wiht specific value obtained within text
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
The HOW-TOs forum is not the the right one in which to ask questions. As it says in one place:
Instructional HowTos, posted by users. No questions here please
and in another:
PLEASE DO NOT POST QUESTIONS HERE
But, assuming the R line is always 2 lines down from the /COM line, here is an answer:
Use "Posix" regular expression syntax:
Instructional HowTos, posted by users. No questions here please
and in another:
PLEASE DO NOT POST QUESTIONS HERE
But, assuming the R line is always 2 lines down from the /COM line, here is an answer:
Use "Posix" regular expression syntax:
Search | Find... (<F5>):Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
Find what: ^(/COM, REAL )([0-9]+)\n(.*)\n(R, )[0-9]+
Replace with: \1\2\n\3\n\4\2
[X] Regular expression
Replace All