Hi Barry,
On Thu, Nov 10, 2011 at 2:34 AM, Barry Brevik bbre...@stellarmicro.com wrote:
Below is some test code that will be used in a larger program.
In the code below I have a regular expression who's intent is to look
for 1 or more characters , 1 or more characters and replace the
Below is some test code that will be used in a larger program.
What I am trying to do is process lines from a CSV file where some of
the 'cells' have commas embedded in the (see sample code below). I might
have used text::CSV but as far as I can tell that module also can not
deal with embedded
, November 09, 2011 5:35 PM
To: perl Win32-users
Subject: Problem with regex
Below is some test code that will be used in a larger program.
What I am trying to do is process lines from a CSV file where some of the
'cells' have commas embedded in the (see sample code below). I might have used
text
use strict;
use warnings;
my $Data = 'Hello, i am a litte String.$ Please format me.$$$
I am the end of the String.$$ And i am the last!';
$Data =~ s/([^\$]*)\${3,3}([^\$]+)/$1\br\\br\$2/gm;
$Data =~ s/([^\$]*)\${2,2}([^\$]+)/$1\p\$2/gm;
$Data =~ s/([^\$]*)\${1,1}([^\$]+)/$1\br\$2/gm;
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
Hello,
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
brbr (please don't think about the why)
If tried to use the following:
$data =~ s/\$\$\$/brbr/gm; #should
.$$ 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
Holger,
This worked for me note that you need to escape the $ characters in your string. The 3398 numberis 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
At 09:47 AM 5/12/2006, Yekhande, Seema \(MLITS\) wrote:
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