From: Leo on
Karl E. Peterson submitted this idea :
> Kevin Provance was thinking very hard :
>> "Leo" <ttdhead(a)gmail.com> wrote in message
>> news:i0gq49$u7o$1(a)news.eternal-september.org...
>>>
>>> I would have thaught INSTR would do the trick for finding and using a
>>> module level variable for keeping track of where to start searching
>>> from and maybe one for the search term too check if we it is a new
>>> term/string to search for.
>>
>> Many moons ago I rolled my own Find/Replace which is no longer used in
>> production, but as I never delete anything code wise, I would imagine it's
>> still around someplace and would work great with this project.
>>
>> I guess maybe - considering Karl's events - I would pass the whole text and
>> also pass back the position to highlight using the Find/Replace events.
>> Replace all I would handle all at once with Replace, allowing for case
>> sensitive searches and the like. I guess we would be grateful there isn't
>> pattern matching included.
>>
>> There a bunch of different ways to go here. I have confidence Karl will
>> pick (or rather, write) the best. <g>
>
> It's the "Match whole words only" part where it really gets spooky. <g> I
> remember entering a contest Crescent Software held back in the 80s to see who
> could write the fastest Word Counter app with QuickBasic. OMG, the issues
> come at you fast and furious, and at some point you just have to close your
> eyes and *hope*. <g>
>
> Proposal: Go ahead with Instr, and when you find a match check the character
> before and after to see if it's alpha? Would that cover 99% of the cases?
> Of course, "back in the day", no one used those funky accented upper-ASCII
> things, either.
>
> And if you *really* wanted to write an all-purpose routine, you'd have to
> include full-on Unicode support, too, eh? I have no idea how to define a
> "whole word" in that realm.

If I am reading that correctly, then that isn't what wordpad does. If
you say enter 78hello87 into wordpad and search for it, it includes the
numbers as part of the word when "Match whole words only" is checked.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: Karl E. Peterson on
Leo formulated on Wednesday :
> Karl E. Peterson submitted this idea :
>> Kevin Provance was thinking very hard :
>>> "Leo" <ttdhead(a)gmail.com> wrote in message
>>> news:i0gq49$u7o$1(a)news.eternal-september.org...
>>>>
>>>> I would have thaught INSTR would do the trick for finding and using a
>>>> module level variable for keeping track of where to start searching
>>>> from and maybe one for the search term too check if we it is a new
>>>> term/string to search for.
>>>
>>> Many moons ago I rolled my own Find/Replace which is no longer used in
>>> production, but as I never delete anything code wise, I would imagine it's
>>> still around someplace and would work great with this project.
>>>
>>> I guess maybe - considering Karl's events - I would pass the whole text
>>> and also pass back the position to highlight using the Find/Replace
>>> events. Replace all I would handle all at once with Replace, allowing for
>>> case sensitive searches and the like. I guess we would be grateful there
>>> isn't pattern matching included.
>>>
>>> There a bunch of different ways to go here. I have confidence Karl will
>>> pick (or rather, write) the best. <g>
>>
>> It's the "Match whole words only" part where it really gets spooky. <g> I
>> remember entering a contest Crescent Software held back in the 80s to see
>> who could write the fastest Word Counter app with QuickBasic. OMG, the
>> issues come at you fast and furious, and at some point you just have to
>> close your eyes and *hope*. <g>
>>
>> Proposal: Go ahead with Instr, and when you find a match check the
>> character before and after to see if it's alpha? Would that cover 99% of
>> the cases? Of course, "back in the day", no one used those funky accented
>> upper-ASCII things, either.
>>
>> And if you *really* wanted to write an all-purpose routine, you'd have to
>> include full-on Unicode support, too, eh? I have no idea how to define a
>> "whole word" in that realm.
>
> If I am reading that correctly, then that isn't what wordpad does. If you say
> enter 78hello87 into wordpad and search for it, it includes the numbers as
> part of the word when "Match whole words only" is checked.

Yeah, I'd call those numeric, not alpha. But that's interesting, I'd
have to try it to really see what you're saying. OTOH, I'd say you
have a hit if it were "hello!", eh?

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Kevin Provance on

"Karl E. Peterson" <karl(a)exmvps.org> wrote in message
news:i0gr46$7hk$1(a)news.eternal-september.org...

: It's the "Match whole words only" part where it really gets spooky. <g>
: I remember entering a contest Crescent Software held back in the 80s
: to see who could write the fastest Word Counter app with QuickBasic.
: OMG, the issues come at you fast and furious, and at some point you
: just have to close your eyes and *hope*. <g>
:
: Proposal: Go ahead with Instr, and when you find a match check the
: character before and after to see if it's alpha? Would that cover 99%
: of the cases? Of course, "back in the day", no one used those funky
: accented upper-ASCII things, either.

Okay...I'm going to go code digging to see what I did back then...and if I
even broached the "whole word" option. I had *just* started using VB5 back
then (I avoided 4 like the plague), which means I was still using VB3 more
than anything else. It may not be pretty to look at.

--
Customer Hatred Knows No Bounds at MSFT
Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc

Bawwk! Paulie want a dingleball, bawwk!

From: Karl E. Peterson on
Karl E. Peterson submitted this idea :
> Long story, short, here's the result:
>
> http://vb.mvps.org/samples/_beta/FindReplace.zip

Just updated, adding support for the ShowHelp flag, including a new
event when that button is clicked.

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Leo on
Karl E. Peterson has brought this to us :
> Leo formulated on Wednesday :
>> Karl E. Peterson submitted this idea :
>>> Kevin Provance was thinking very hard :
>>>> "Leo" <ttdhead(a)gmail.com> wrote in message
>>>> news:i0gq49$u7o$1(a)news.eternal-september.org...
>>>>>
>>>>> I would have thaught INSTR would do the trick for finding and using a
>>>>> module level variable for keeping track of where to start searching
>>>>> from and maybe one for the search term too check if we it is a new
>>>>> term/string to search for.
>>>>
>>>> Many moons ago I rolled my own Find/Replace which is no longer used in
>>>> production, but as I never delete anything code wise, I would imagine
>>>> it's still around someplace and would work great with this project.
>>>>
>>>> I guess maybe - considering Karl's events - I would pass the whole text
>>>> and also pass back the position to highlight using the Find/Replace
>>>> events. Replace all I would handle all at once with Replace, allowing for
>>>> case sensitive searches and the like. I guess we would be grateful there
>>>> isn't pattern matching included.
>>>>
>>>> There a bunch of different ways to go here. I have confidence Karl will
>>>> pick (or rather, write) the best. <g>
>>>
>>> It's the "Match whole words only" part where it really gets spooky. <g> I
>>> remember entering a contest Crescent Software held back in the 80s to see
>>> who could write the fastest Word Counter app with QuickBasic. OMG, the
>>> issues come at you fast and furious, and at some point you just have to
>>> close your eyes and *hope*. <g>
>>>
>>> Proposal: Go ahead with Instr, and when you find a match check the
>>> character before and after to see if it's alpha? Would that cover 99% of
>>> the cases? Of course, "back in the day", no one used those funky accented
>>> upper-ASCII things, either.
>>>
>>> And if you *really* wanted to write an all-purpose routine, you'd have to
>>> include full-on Unicode support, too, eh? I have no idea how to define a
>>> "whole word" in that realm.
>>
>> If I am reading that correctly, then that isn't what wordpad does. If you
>> say enter 78hello87 into wordpad and search for it, it includes the numbers
>> as part of the word when "Match whole words only" is checked.
>
> Yeah, I'd call those numeric, not alpha. But that's interesting, I'd have to
> try it to really see what you're saying. OTOH, I'd say you have a hit if it
> were "hello!", eh?

Nope it doesn't find hello in that string so wordpad in an English
locale counts numbers as part of a word. But If I add an _ to the
begining and a + at the end and search for the original string it
ignores the two new characters.

--
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org