On Thu, 14 Feb 2002, Russ Foster wrote: > I have string, something like: > > $String = "aaa bbb: fffd: sdfsdf qweqd: adfsdf qwcdsfs: qwdq qchuti: > qwiojd"; > > Now, I want to extract everything from the start of the string, up through > the FIRST colon ":" -- in this case "aaa bbb". My regex looks like this:
I would go with split here. This is the kind of thing split is intended for: my $String = "aaa bbb: fffd: sdfsdf qweqd: adfsdf qwcdsfs: qwdq qchuti: qwiojd"; my $str1 = (split /:\s+/, $String)[0]; print "$str1\n"; -- Brett http://www.chapelperilous.net/ ------------------------------------------------------------------------ The distinction between Freedom and Liberty is not accurately known; naturalists have been unable to find a living specimen of either. -- Ambrose Bierce -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]