Re: [PBML] regular expression help
- On Thursday 05 August 2004 13:41 Luca Ferrari's cat walking on the keyboard
> Hi,Hi guys,
> supposing I've got a string like the following:
> and that I'd like to keep only the first characters before the first
> '.' (e.g., 'a'), why the following is not working?
> $string =~ s/^(.+)\.(.*)/$1/;
> Applied to the above example string it gives me back only 'f'. Any
thanks everybody for the help.
The solution I adopted is
$string =~ s/^(.+?)\.(.*)/$1/;
I know that I could use split, but since perl has a regexp engine why don't