SPUG:m,n -- why?
Tim Maher
tim at consultix-inc.com
Sat Mar 15 12:14:43 CST 2003
On Fri, Mar 14, 2003 at 11:24:15PM -0800, Michael R. Wolf wrote:
>
> Does anyone know the historical roots of "n" and "m" for "min" and
> "max" in the regex quantifiers? I can never get a mnemonic for which
> is which. (Of course, the min is to the left of the max.) Perhaps if
> I know it's roots, I'll remember.
That comes from the good-old ed editor, which provided the same
metacharacters. M comes first, and then n. I believe they were
chosen for Fortranish reasons; i, j, and k were always the the first
three (automatically understood as) integer variables one would
use in a program, so to mark these placeholders as integers but
special in some way, i.e., not the conventional loop indices i,j,
or k, Brian Kernighan started with m. M conveniently stands for
minimum too, and N is just the next sequential letter (no mnemonic).
Go figure . . .
> That is (n,m) = (0,7) in this snippet:
>
> if ($fruit =~ /b(an){0,7}a/) {
> print "You've got an modular banana\n";
> }
>
>
> --
> Michael R. Wolf
> All mammals learn by playing!
> MichaelRunningWolf at att.net
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
> POST TO: spug-list at mail.pm.org
> ACCOUNT CONFIG: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays, U-District, Seattle WA
> WEB PAGE: www.seattleperl.org
--
*==============================================================================*
| Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# |
| tim at consultix-inc.com www.consultix-inc.com www.softwareprofessor.com |
*==============================================================================*
More information about the spug-list
mailing list