Holger,

Actually $ is a special character in string in perl. So, if the $ is there in 
the input,
you will have to always write it with the leading escape character. 

So, make your input will be like this,
my $data = "Hello, i am a litte String.$ Please format me.$$$ I am the end
of the String.$$ And i am the last!";

It will solve your problem.

Thanks,
Seema
GPCT|TDDS|AIS|SPCM3


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Holger Wöhle
Sent: Friday, May 12, 2006 6:09 PM
To: perl-win32-users@listserv.ActiveState.com
Subject: Problem with regex 


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

my $Data = "Hello, 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
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the sender, 
delete it and do not read, act upon, print, disclose, copy, retain or 
redistribute it. Click here for important additional terms relating to this 
e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to