Match beginning of two strings
Jim Richardson
warlock at eskimo.com
Sat Aug 2 19:03:50 EDT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sat, 02 Aug 2003 17:39:26 -0400,
Ravi <rxs141 at cwru.edu> wrote:
> Hi,
>
> I have about 200GB of data that I need to go through and extract the
> common first part of a line. Something like this.
>
> >>>a = "abcdefghijklmnopqrstuvwxyz"
> >>>b = "abcdefghijklmnopBHLHT"
> >>>c = extract(a,b)
> >>>print c
> "abcdefghijklmnop"
>
> Here I want to extract the common string "abcdefghijklmnop". Basically I
> need a fast way to do that for any two given strings. For my situation,
> the common string will always be at the beginning of both strings. I can
> use regular expressions to do this, but from what I understand there is
> a lot of overhead. New data is being generated at the rate of about 1GB
> per hour, so this needs to be reasonably fast while leaving CPU time for
> other processes.
>
> Thanks
> Ravi
>
Are you trying to match any to any strings? or only a pair as above?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/LENWd90bcYOAWPYRAtWhAJ4ozTD1G3xLzVkeuJvPDJTsLbkcBQCfX4E0
YR/+zWSPDwX0uUf8y0QkxJs=
=sGTb
-----END PGP SIGNATURE-----
--
Jim Richardson http://www.eskimo.com/~warlock
Linux, because eventually, you grow up enough to be trusted with a fork()
More information about the Python-list
mailing list