home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / rexx / 932 < prev    next >
Encoding:
Text File  |  1992-09-08  |  1.7 KB  |  46 lines

  1. Newsgroups: comp.lang.rexx
  2. Path: sparky!uunet!noc.near.net!ns.draper.com!news.draper.com!MVS.draper.com!SEB1525
  3. From: SEB1525@MVS.draper.com (Steve Bacher)
  4. Subject: Regular expression syntax
  5. Message-ID: <19920908084344SEB1525@MVS.draper.com>
  6. Sender: MVS NNTP News Reader <NNMVS@MVS.draper.com>
  7. Nntp-Posting-Host: mvs.draper.com
  8. Organization: Draper Laboratory
  9. Date: Tue, 8 Sep 1992 13:43:00 GMT
  10. Lines: 34
  11.  
  12. Now that the idea has been seriously suggested, why don't we try to
  13. come up with a nice REXXy syntax for regular expressions?
  14.  
  15. In the REXX tradition, it should be readable:  i.e. wordy and with
  16. minimal use of special characters.
  17.  
  18. How about this to kick off a discussion...
  19.  
  20.  Unix-style regexp                Proposed REXX-style expression
  21.  
  22.   abc                             "abc"
  23.   a.c                             "a" ANY "c"
  24.   a*                              ZERO_OR_MORE("a")
  25.   a.*                             "a" ZERO_OR_MORE(ANY)
  26.   a[bc]d  (them's sq. brackets)   "a" ("b" OR "c") "d"
  27.   ^abc                            BEGIN "abc"
  28.   abc$                            "abc" END
  29.  
  30. Then we could have a function MATCH(string,pattern) where pattern
  31. is a regexp as above.  And we could have PARSE PATTERN pattern WITH...
  32.  
  33. Maybe we need to separate the pattern elements with commas, or
  34. surround the whole thing in a REGEXP(...) pseudofunction call.
  35. Should patterns be evaluated like other REXX expressions, or
  36. do we need a special syntax for run-time pattern generation
  37. a la parentheses in PARSE?
  38.  
  39. Well, you get the idea.  Remember, verbosity is not a bad thing
  40. in REXX.  I'm sure that youse can come up with something better
  41. if you try.
  42.  
  43. --
  44. Steve Bacher (Batchman)                 Draper Laboratory
  45. Internet: seb@draper.com                Cambridge, MA, USA
  46.