From: Larry Serflaten on

"mcnews" <mcourter(a)mindspring.com> wrote
<...>
> that is pretty much what i am doing now except that i am just looking
> for the first marker. what would be the best way to grab the text
> between to start and end markers?

Load the marked text into a string
Load the replaceing text from the file, into a string
Use Instr to find the first and last markers
Build a third string using the first part, file text, and last part of the marked text.

If you're talking several megabytes of text, send the output to a file,
rather than building the third string in memory....

LFS


From: mcnews on
On Apr 19, 2:09 pm, "Larry Serflaten" <serfla...(a)usinternet.com>
wrote:
> "mcnews" <mcour...(a)mindspring.com> wrote
> <...>
>
> > that is pretty much what i am doing now except that i am just looking
> > for the first marker.  what would be the best way to grab the text
> > between to start and end markers?
>
> Load the marked text into a string
> Load the replaceing text from the file, into a string
> Use Instr to find the first and last markers
> Build a third string using the first part, file text, and last part of the marked text.
>
> If you're talking several megabytes of text, send the output to a file,
> rather than building the third string in memory....
>
> LFS

i know how to do all but > Load the marked text into a string

am i reading from an input buffer until i see me 2nd marker?
From: dpb on
mcnews wrote:
....

> i know how to do all but > Load the marked text into a string
>
> am i reading from an input buffer until i see me 2nd marker?

Yet again, I say, Mid$ is your friend

Dim Char1 As String, Char2 As String ! For search char's (or Const)
Dim Str1 As String, MarkStr As String

Dim IdxStrt As Long, IdxEnd As Long

IdxStrt = Instr(Str1,Char1) % First char pos'n in Str1
IdxEnd = Instr(IdxStrt+1,Str1,Char2) % Begin after first
! Do your error checking that both indices are nonzero...
MarkStr = Mid$(Str1,IdxStrt,IdxStrt-IdxEnd+1)

--
From: mcnews on
On Apr 19, 1:42 pm, dpb <n...(a)non.net> wrote:
> mcnews wrote:
>
> ...
>
> > i know how to do all but > Load the marked text into a string
>
> > am i reading from an input buffer until i see me 2nd marker?
>
> Yet again, I say, Mid$ is your friend
>
> Dim Char1 As String, Char2 As String ! For search char's (or Const)
> Dim Str1 As String, MarkStr As String
>
> Dim IdxStrt As Long, IdxEnd As Long
>
> IdxStrt = Instr(Str1,Char1)  % First char pos'n in Str1
> IdxEnd  = Instr(IdxStrt+1,Str1,Char2)  % Begin after first
> ! Do your error checking that both indices are nonzero...
> MarkStr = Mid$(Str1,IdxStrt,IdxStrt-IdxEnd+1)
>
> --

with a little tweaking that works great!
thank ya.
From: dpb on
dpb wrote:
....

> MarkStr = Mid$(Str1,IdxStrt,IdxStrt-IdxEnd+1)

woops...

MarkStr = Mid$(Str1,IdxStrt,IdxEnd-IdxStrt+1)

--