One thing i don't understand. In your first posts you gave me the impression that the text you want to remove always start with the word "START"? In your last example the text does not contain the word "START" at all. So where do you want to start in this case? Or should i assume there is the word "START" before CREATIONTIME?
If the start differ so sometime you want to start with the word "START" and other times something different i believe this could be hard to solve.
Also if the lines differ it would be nice with an example that include more lines which is a bit different. It look's like a challenge to solve this and will probably not be possible with a single search and replace.
replace blocks of words starting and ending with x and y
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 7
- Joined: Wed Apr 16, 2008 12:40 pm
exact text
Gan,
My first few posts wer examples only. My last post was an exact snippet from the 2MB text file. The exact "start word to replace is: creationtime:
CREATIONTIME='2002-10-10T16:13:46'
The exact end word is fs28:
\ri140\plain\f5\fs28\cf0\b\protect [auto-insert:
Please call me if I am not being clear. 540-316-5504
Thanks,
Kevin
My first few posts wer examples only. My last post was an exact snippet from the 2MB text file. The exact "start word to replace is: creationtime:
CREATIONTIME='2002-10-10T16:13:46'
The exact end word is fs28:
\ri140\plain\f5\fs28\cf0\b\protect [auto-insert:
Please call me if I am not being clear. 540-316-5504
Thanks,
Kevin
The example you gave me from the textfile:
You want to remove everything from CREATIONTIME to fs28 and replace with a CR, right? If that is correct you could create a macro and while recording you can search for "CREATIONTIME", then make a new search where you check "Extend selection" and search for fs28. Then everything from CREATIONTIME to fs28 shoud be selected and you can press enter to replace that text with a CR. Then you save the macro and click "Repeat to end of file".
When running this macro it should work the way you want if i understand this correctly. If this is not correct please give an example with more then one line which show how it looks now and how you want it to be. Running this macro should remove everything except: \cf0.
After running this macro you might end up with a lot of blank lines that you don't want. In that case you can do a search and replace with regular expression and search for ^\n and replace with nothing. You could include this in the macro as well of course.
Code: Select all
CREATIONTIME='2002-10-10T16:13:46' LASTMODIFIEDTIME='2002-11-29T17:27:05' SCOPE='<FormScope><Modality>CR</Modality><BodyPart>CSPINE</BodyPart><BodyPart>SPINE</BodyPart></FormScope>'
TEXTFORMAT='4' TEXT='{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss Arial;}{\f3\froman Times New Roman;}{\f4\fswiss\fprq2 System;}{\f5\froman\fprq2 Times New Roman;}}
{\colortbl\red0\green0\blue0;\red255\green255\blue255;}
\deflang1033\pard\ri140\plain\f5\fs28\cf0
When running this macro it should work the way you want if i understand this correctly. If this is not correct please give an example with more then one line which show how it looks now and how you want it to be. Running this macro should remove everything except: \cf0.
After running this macro you might end up with a lot of blank lines that you don't want. In that case you can do a search and replace with regular expression and search for ^\n and replace with nothing. You could include this in the macro as well of course.