Hi-
Try:
#!/usr/bin/perl
use strict;
use warnings;
my $subject = "Re: Re: Re: Re: Howdy";
print "origonal: $subject\n";
$subject =~ s/(Re:\s)+/$1/g;
print "final: $subject\n";
(tested)
Dress it up as you wish, i.e. .../gi; is a
cassless match, etc.
Aloha => Beau.
-----Original Message-----
From: Gavin Laking [mailto:[EMAIL PROTECTED]]
Sent: Saturday, November 23, 2002 3:09 AM
To: [EMAIL PROTECTED]
Subject: Checking for multiple instances of a string
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi folks,
I've configured the forum software I am writing to automatically add the
line 'Re: subjectNameHere' to the subject field when a user wishes to
reply to a post. Now I've encountered a problem, when the reply is a
reply to a previous reply:
* How do I start X?
* Re: How do I start X?
*Re: Re: How do I start X?
Is there a way I can search for more than one instance of 'Re:' and
delete all but one, or would it be faster to search for one or more
instances of 'Re:' and delete them all and then just add one instance?
GL
- --
Gavin Laking - Web Development Daemon
http://www.gavinlaking.co.uk
- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
iD8DBQE93334aMak7Ylvm3ARAhmbAJ9JULux7WLfLKSHVFK3hyZuaGa3gQCgpabF
TGrFO2NjDPXqfoZ73z2McFQ=
=25x6
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]