Date: Tue, 11 Nov 1997 02:02:58 GMT
Reply-To: REXX Programming discussion list <REXXLIST@UGA.CC.UGA.EDU>
Sender: REXX Programming discussion list <REXXLIST@UGA.CC.UGA.EDU>
From: Patrick TJ McPhee <ptjm@INTERLOG.COM>
Organization: Crampton Vinegar Works
Subject: Re: regular expression matching
In article <199711110016.TAA01650@main.blclinks.net>,
F. Scott Ophof <fsophof@MAIN.BLCLINKS.NET> wrote:
% A number of the functions built into REXX can be seen as forms of
% "regular expressions", like LEFT() and RIGHT(), which compare
% quite nicely (imho) to "^" and "$" (if I'm not mistaken as to the
% symbols used for those regexps).
In a limited sense, this is true. The awk expressions
x ~ "^heigh ho"
x ~ "heigh ho$"
are equivalent to the rexx expressions
left(x,8) = "heigh ho"
right(x,8) = "heigh ho"
But more complicated regular expressions are more difficult to express in
Rexx, and sometimes the regular expression is clearer. The trouble is
that every common program that makes use of regular expressions (I'm
thinking grep, egrep. sed, awk, lex, etc) uses a slightly different
syntax. Posix has standardised this with yet another syntax.
An example of something that would be easier with a form of regular
parse linein name :num: age height weight .
which could be used to parse names, ages, heights, and weights from an
input of the form
Alfred C R Clarke 45 170 80
James McNee 43 200 82
and so forth.
Patrick TJ McPhee
East York Canada