home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6794 < prev    next >
Encoding:
Text File  |  1992-11-21  |  1.4 KB  |  34 lines

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