John W. Krahn 写道:
$ perl -le' for ( "abc from to the word by and the end", "abc from to the end" ) { print $1 if /from(.*?(?=by)|.*)/; } '
But this coundn't handle this case: $string = "abc from to the word byebye..."; Maybe a space following the "by" is needed? :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/