nope... regular expression because I want to use it again to substitute that
common part with a new string

basically with the example below I would want to change 'crap' to
'somethingelse' but the I want to be able to use it with various arrays that
have different common strings that I won't know before hand.

-----Original Message-----
From: Paul Johnson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 07, 2002 11:31 AM
To: Nikola Janceski
Cc: Beginners (E-mail)
Subject: Re: Long shot on possibly existent pattern matching module?


On Thu, Mar 07, 2002 at 09:52:43AM -0500, Nikola Janceski wrote:
> I think I am asking a bit much on this...
> 
> I was wondering if there is a module out there that will find a the common
> pattern among an array of strings and return the regular expression to
match
> the common part.

Do you really want a regular expression?

How about:

  sub common { ".*" }

> ie:
> @stuff = qw (123crapstuff morecrap crappedshit);
> 
> I want the module to return 'crap' since that is the common part in all
the
> items.
> 
> I know... real long shot. I tried searching but don't even know what to
> search for.

Try Algorithm::Diff.  I doesn't do just what you want, but it might get
you part of the way there.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to