In the @x i am expecting to get all the http paths just like u showed in ur example.
This should work fine.  

Thanx,


-Sharad

-----Original Message-----
From: Todd W. [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 9:32 PM
To: [EMAIL PROTECTED]
Subject: Re: Look Ahead



"Sharad Gupta" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hi All,
>
> I have a path like:
>
> $s = "http::/foo/bar:http::/foo1/bar1:http/foo1/bar1";
                                                            ^^
Is your data accurately reflected in $s? There is no :: after the last
'http'?

> I am trying to get all the http paths which are seperated by ":" like
this:
>
> @x = ($s =~ /(http::.*?):(?=http::.*?)/g)

Could you explain what you want in @x? Right off I'm not sure what you
expect the look ahead to do for you. I think you can do without it. If I am
reading correctly, you want to seperate the data at the colins:

[EMAIL PROTECTED] trwww]$ perl
$s = "http::/foo/bar:http::/foo1/bar1:http::/foo1/bar1";
@x = $s =~ /(http::[^:]+)/g;
print( map { "$_\n" } @x );
Ctrl-D
http::/foo/bar
http::/foo1/bar1
http::/foo1/bar1

if the '::'s are optional like in the string you posted, use:

[EMAIL PROTECTED] trwww]$ perl
$s = "http::/foo/bar:http::/foo1/bar1:http/foo1/bar1";
@x = $s =~ /(http:?:?[^:]+)/g;
print( map { "$_\n" } @x );
Ctrl-D
http::/foo/bar
http::/foo1/bar1
http/foo1/bar1

Todd W.



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

Reply via email to