home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!usc!cs.utexas.edu!torn!news.ccs.queensu.ca!slip204.telnet1.QueensU.CA!dmurdoch
- From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
- Subject: Re: GREP procedure
- Message-ID: <dmurdoch.180.722353582@mast.queensu.ca>
- Lines: 22
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University
- References: <1992Nov13.174232.1428@dcatlas.dot.gov> <By0yEM.ExD@gabriel.keele.ac.uk>
- Date: Sat, 21 Nov 1992 13:46:22 GMT
-
- In article <By0yEM.ExD@gabriel.keele.ac.uk> csn73@seq1.keele.ac.uk (P.R. Harding) writes:
- >Second:
- >Has anyone got a procedure that is similar to the GREP command in UNIX.
- >
- >I would be greatful if you could send me some ideas or if you have the
- >procedure a copy of the procedure. Basically I need to read a string in
- >a text file, just as GREP does.
-
- Reading a string isn't hard, but it depends on which compiler you're using.
- In TP, just declare a variable to be a string and readln it.
-
- Matching a simple pattern is also easy in TP, using the Pos procedure.
-
- Matching a GREP-like regular expression is harder; the new BP 7 comes with
- C source to GREP that you can call directly from your Pascal program (in
- protected mode only, the interface is through a DLL). I wrote a pattern
- matcher a long time ago that doesn't quite use regular expressions, but is
- reasonably close; it's called tpmatch.zip, and should be available on garbo.
- uwasa.fi.
-
- Duncan Murdoch
- dmurdoch@mast.queensu.ca
-