Holger,
 
This worked for me.... note that you need to escape the $ characters in your string.  The "3398" number is actually the PID of the perl process returned from the special variable $$ ... since you didn't escape the $ characters..
 

my $Data = "" i am a litte String.\$ Please format me.\$\$\$ I am the end
of the String.\$\$ And i am the last!";

$Data =~ s/[\$]{3}/<br><br>/;
$Data =~ s/[\$]{2}/<p>/;
$Data =~ s/\$/<br>/;

print $Data ."\n";

Hope that helps...
 
Andy Speagle
 
-----

 
On 5/12/06, Holger Wöhle <[EMAIL PROTECTED]> wrote:

Hello,
under Windows with ActiveState Perl i have a strange problem with a regex:
Assuming the following String:

my $Data = "" i am a litte String.$ Please format me.$$$ I am the end
of the String.$$ And i am the last!"

The regex should replace $ with the string <br>, $$ with <p> and $$$ with
<br><br> (please don't think about the why)

If tried to use the following:
$data =~ s/\$\$\$/<br><br>/gm; #should catch every occurrence of $$$
$data =~ s/\$\$/<p>/gm; #should catch $$
$data =~ s/\$/<br>/gm; #the rest

So data should look after the first regex:
Hello, i am a litte String.$Please format me.<br><br>I am the end of the
String.$$And i am the last!
And after the second:
Hello, i am a litte String.$Please format me.<br><br>I am the end of the
String.<p>And i am the last!
And the last:
Hello, i am a litte String.<br>Please format me.<br><br>I am the end of the
String.<p>And i am the last!

But all regexes i tried (the one above are only one try) failed! When i
print out the string it looks like:

Hello, i am a litte String. Please format me. I am the end of the
String.3398 And i am the last!

Where the number after String. differs between every run.

Can someone help me ?

With regars
Holger

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to