From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of sekhar
kavuru
Sent: 28 October 2005 16:51
To: [email protected]
Subject: Need help with regex
> Hi All
>
>
> I need a REGEX to get a string between two characters from a static
string
>
>
> e.g. /install/sql/foo.c@@/main/integration/1
Hmmm... Looks like clearcase.
>
>
>
> I need to get foo.c , i.e string between / and @@
>
>
>
> First it needs find where @@ occurs in the string and trace back to
file name until it encounters / character.
I wouldn't do it that way, especially as it is a common requirement to
break strings like that into their consituent parts. A more reusable way
top do it would be like this.
use strict;
use warnings;
use File::Basename;
my $str = '/install/sql/foo.c@@/main/integration/1';
my ($dir, $file, $version) = cc_parse($str);
print "dir=$dir file=$file version=$version\n";
sub cc_parse {
my $str = shift;
my ($pathname, $version) = split '@@', $str;
my $file = basename $pathname;
return (dirname($pathname), basename($pathname), $version);
}
You might also consider putting this sub in a package with other useful
subs.
HTH
--
Brian Raven
=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the
intended addressee(s). Unauthorised reproduction, disclosure, modification,
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately
and delete it from your system. The views expressed in this message do not
necessarily reflect those of Atos Euronext Market Solutions.
L'information contenue dans cet e-mail est confidentielle et uniquement
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee.
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail
vous parvient par erreur, nous vous prions de bien vouloir prevenir
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre
systeme. Le contenu de ce message electronique ne represente pas necessairement
la position ou le point de vue d'Atos Euronext Market Solutions.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs