<div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace">Hi Dan,</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">It sounds to me like an "optimizer" is needed. There is alreay a compiler</div><div class="gmail_default" style="font-family:monospace,monospace">that uses FA's. Is someone else going to create a program</div><div class="gmail_default" style="font-family:monospace,monospace">to look for dates without using regular expressions?</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Today, I write small-sized RE's. If I write a giant RE, there is nothing preventing</div><div class="gmail_default" style="font-family:monospace,monospace">the owner of RE world to change how they are used. For instance. Compile your RE</div><div class="gmail_default" style="font-family:monospace,monospace">and a subroutine/function is produced that performs the RE search.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">RE is a <b>language</b>, not necessarily an implementation.</div><div class="gmail_default" style="font-family:monospace,monospace">At least that is my understanding.</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace"><br></div><div class="gmail_default" style="font-family:monospace,monospace">Ed</div><div class="gmail_default" style="font-family:monospace,monospace"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 6, 2023 at 3:02 PM Dan Cross <<a href="mailto:crossd@gmail.com" target="_blank">crossd@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Mar 6, 2023 at 5:02 AM Ed Bradford <<a href="mailto:egbegb2@gmail.com" target="_blank">egbegb2@gmail.com</a>> wrote:<br>
>[snip]<br>
> I would like to extend my program to<br>
> any date format. That would require<br>
> a much bigger RE. I have been led to<br>
> believe that a 50Kbyte or 500Kbyte<br>
> RE works just as well (if not<br>
> as fast) as a 100 byte RE. I think<br>
> with parentheses and<br>
> pipe-symbols suitably used,<br>
> one could match<br>
><br>
>   Monday, March 6, 2023<br>
>   2023-03-06<br>
>   Mar 6, 2023<br>
>   or<br>
>   ...<br>
<br>
This reminds me of something that I wanted to bring up.<br>
<br>
Perhaps one _could_ define a sufficiently rich regular expression that<br>
one could match a number of date formats. However, I submit that one<br>
_should not_. REs may be sufficiently powerful, but in all likelihood<br>
what you'll end up with is an unreadable mess; it's like people who<br>
abuse `sed` or whatever to execute complex, general purpose programs:<br>
yeah, it's a clever hack, but that doesn't mean you should do it.<br>
<br>
Pick the right tool for the job. REs are a powerful tool, but they're<br>
not the right tool for _every_ job, and I'd argue that once you hit a<br>
threshold of complexity that'll be mostly self-evident, it's time to<br>
move on to something else.<br>
<br>
As for large vs small REs.... When we start talking about differences<br>
of orders of magnitude in size, we start talking about real<br>
performance implications; in general an NDFA simulation of a regular<br>
expression will have on the order of the length of the RE in states,<br>
so when the length of the RE is half a million symbols, that's<br>
half-a-million states, which practically speaking is a pretty big<br>
number, even though it's bounded is still a pretty big number, and<br>
even on modern CPUs.<br>
<br>
I wouldn't want to poke that bear.<br>
<br>
        - Dan C.<br>
</blockquote></div><br clear="all"><div><br></div><span>-- </span><br><div dir="ltr"><font face="'courier new', monospace"><span style="font-weight:900"><div>Advice is judged by results, not by intentions.</div><div>  Cicero</div></span></font><div><br></div></div>