I have made an attempt to make my RE stuff readable and supportable. I
think I write more description that I do RE "code". As for, *it won't be
comprehendable,* Machine language
was unreadable and then along came assembly language. Assembly language was
unreadable, then came higher level languages. Even higher level languages
are unsupportable if not well documented and mostly simple to understand
("you are not expected to understand this" notwithstanding). The jump from
machine language to python today
was unimagined in early times.
[
As an old timer, I see inflection points
between:
machine language and assembly language
assembly language and high level languages
and
high level languages and python.
But that's just me.
]
I think it is possible to make a 50K RE that is understandable. However, it
requires
a lot of 'splainin' throughout the code. I'm naive though; I will
eventually discover
a lack of truth in that belief, if such exists.
I repeat. I put stuff down for months at a time. My metric is *coming back
to it*
*and understanding where I left off*. So far, I can do that for this RE
program that
works for small files, large files,
binary files and text files for exactly one pattern:
YYYY[-MM-DD]
I constructed this RE with code like this:
# ymdt is YYYY-MM-DD RE in text.
# looking only for 1900s and 2000s years and no later than today.
_YYYY = "(19\d\d|20[01]\d|202" + "[0-" + lastYearRE) + "]" +
"){1}"
# months
_MM = "(0[1-9]|1[012])"
# days
_DD = "(0[1-9]|[12]\d|3[01])"
ymdt = _YYYY + '[' + _INTERNALSEP +
_MM +
_INTERNALSEP +
']'{0,1)
For the whole file, RE I used
ymdthf = _FRSEP + ymdt + _BASEP
where FRSEP is front separator which includes
a bunch of possible separators, excluding numbers and letters, or-ed
with the up arrow "beginning of line" RE mark. BASEP is back separator
is same as FRSEP with "^" replaced with "$".
I then aimed ymdthf at "data" the thing that represents
the entire memory mapped file (where there is only one beginning
and one end).
Again, I say validating an RE is as difficult or more than writing one.
What does it miss?
Dates are an excellent test ground for RE's. Latitude and longitude is
another.
Ed
PS: I thought I was on the COFF mailing list. I received this email
by direct mail to from Larry. I haven't seen any other comments
on my submission. I might have unsubscribed, but now I regret it. Dear
powers
that be: Please resubscribe me.