I'm betting you don't get to dictate that the string has no newlines in it.
--
A principle is an instruction in qualitative endeavour.
http://www.hacksaw.org -- http://www.privatecircus.com -- KB1FVD
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED
Marcos,
Try this :
my $str = 'aaa--%%b%bb%%--ccc--%%ddd%%--';
$str =~ s/(-{2}\%{2})(.*?)(\%{2}-{2})/$1$3/g;
print "Modified str = ".$str."\n";
you will get
Modified str = aaa----ccc----
Is it what you want ??
Michel
-Message d'origine-
De: [EMAIL PROTECTED] [mailto:[EMA
Hacksaw wrote:
>
> $str =~ s/--\%\%.*?\%\%--/--\%\%\%\%--/sg;
You don't need all those backslashes. This works as well (and IMHO is
easier to read):
$str =~ s/--%%.*?%%--/----/sg;
Alan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
t.pl:
#!/usr/bin/perl -w
my $str =
'aaa
--%%
b%b
%%--
ccc
--%%ddd%%--';
$str =~ s/--\%\%.*?\%\%--/--\%\%\%\%--/sg;
print $str, "\n";
--
hacksaw > perl t.pl
aaa
----
ccc
----
--
All the magic is in the matching operator.
The ? after the .* makes it match the