Re: Length of regex/pattern for "color"
in message <20031023040705.GA31407@yogmoth>,
wrote Allister MacLeod thusly...
>
> On Wed, Oct 22, 2003 at 04:29:13PM -0400, parv wrote:
> > "~s
> >
> > '(archivers/p5-Archive-Tar|archivers/p5-Compress-Zlib|devel/p5-AppConfig|devel/p5-Class-Factory-Util|devel/p5-Class-Singleton|devel/p5-Config-General|...)'"
(long ass regex is shortened)
> I think maybe you could shorten the regex somewhat..
> Perhaps "~s
> '(archivers/p5-(Archive-Tar|Compress-Zlib)|devel/p5-(AppConfig|Class-(Factory-Util|Singleton)|Config-(General|Ini)))|...'"
Yes, it is quite possible to shorten the regex as above. That was
what i was also thinking of yesterday night.
That would help some, but not quite. Above is an example only for
62 perl ports; i have 306 in total.
> If I can hack together a script to automate such a reduction
> quickly, I will post it later.
I am currently developing a perl program that reads ports' origins
(one per line) from a file, and outputs various regexen. So far,
its output looks like above -- origin/port-a|origin/port-b -- w/o
regard to a port's origin.
Since i was/am stuck as regard to regex's length, i have not
bothered yet to shorten the program's output.
Your effort is welcomed too.
- Parv
--