Re: Finding a pattern in a stream?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Terry Olsen (tolsen64_at_hotmail.com)
Date: 11/03/04


Date: Wed, 3 Nov 2004 07:08:21 -0700

Just doing a quick read of the page it looks as though Regex functions
similarly to the InStr() function. Is Regex actually faster and more
efficient than using InStr?

Also, how would I find my pattern if it is broken up into two "reads"? For
example, I wait for a DataArrival event, read from the serial port and pass
the data out the TCP port. Say the string i'm looking for is "+++ATH". So
I read the serial port and receive "<other data>+++A" and then on the next
read of the serial port I get "TH<more data>". Or maybe it could
conceivably be broken up into 3 or more reads. Is this a situation where I
just have to concatenate the current read with the previous read and then
look for the pattern? Or is there a better way?

Thanks for the help.
Terry

"Ken Tucker [MVP]" <vb2ae@bellsouth.net> wrote in message
news:OS2b0jZwEHA.2540@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> Regular expression are the best way to find patterns.
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconCOMRegularExpressions.asp
>
> Ken
> -----------------------------
> "Terry Olsen" <tolsen64@hotmail.com> wrote in message
> news:%239qzs1WwEHA.2192@TK2MSFTNGP14.phx.gbl...
> Is there a good way to find a pattern of bytes/chars in a stream? I've
> got
> a serial port connected to a tcp port. I need to be able to catch a
> unique
> character string in the stream so that I can perform certain functions.
> For
> example, I have a telnet client connected to an Apple II through the
> serial
> port. The user at the telnet terminal is using the BBS running on the
> Apple
> II just like the good ole days of dialup BBS's. I need to be able to
> catch
> a "command string" sent out from the Apple II (like the "+++ATH") that
> tells
> my app to disconnect the telnet client (in lieu of the modem hanging up).
> Is there a good way to do this?
>
>
>



Relevant Pages

  • Re: What is Hyperterminal for?
    ... communicate directly with a modem, a serial port, to link two PCs together ... actual Windows "Component" used when Windows needs a telnet client. ... To some people it IS a useful tool that carries so little overhead it may as ...
    (microsoft.public.windowsxp.general)
  • Re: RS-232 Digital thermometer - interface and driver
    ... But the big advantage of a modem program for initial ... testing is that you can change the serial port configuration ... > modem program (and a Telnet client, FTP client, etc etc) but also a ... Thanks for the links, Frank. ...
    (comp.os.linux.misc)
  • Re: MSComm Control
    ... I then tried another Telnet client - ZOC and that one ... scales that I have seen are quite simple. ... configure the serial port, ... Data are delimited by a vbCRLF, so receiving each ...
    (microsoft.public.vb.com)