The code below worked for me, after using single
quotes around the original string to prevent any
interpolation (it's always a good practice to
print out the original string to verify that it's
what you thought it was), and, of course, $Data is not the same as $data.
At 08:38 AM 5/12/2006, Holger Wöhle wrote:
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
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Scanned for Spam and Viruses.
PCG Information Technology Services.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs