Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread Rob Dixon
M Z wrote: > hello all - > > I am trying to do the following to this data: > input: > X|YZ||A > > desired output: > X|Y| | | |Z| |A > > simply replacing || with | | > whereever it may occur in the string. > > This bit of code doesn't seem to do all of the job. > > What is wrong with this code?

Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread John W. Krahn
Tim Johnson wrote: > > I'm not really giving you the answer you're looking for, but here is one way > to go about it: > > while(<>){ > my @temp = split(/\|/,$_); > foreach my $item(@temp){ > if($item eq ''){ > $item .= ' '; > } > } > print join('|',@temp); > } Or you could

Re: misunderstanding the /g modifier on REGEX

2003-06-13 Thread Sudarshan Raghavan
CTED] Sent: Thursday, June 12, 2003 5:28 PM To: [EMAIL PROTECTED] Subject: Re: misunderstanding the /g modifier on REGEX M Z wrote: hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing || with | | whereever it may occur in

RE: misunderstanding the /g modifier on REGEX

2003-06-12 Thread Tim Johnson
To: [EMAIL PROTECTED] Subject: Re: misunderstanding the /g modifier on REGEX M Z wrote: > hello all - > > I am trying to do the following to this data: > input: > X|YZ||A > > desired output: > X|Y| | | |Z| |A > > simply replacing || with | | > whereever it may oc

RE: misunderstanding the /g modifier on REGEX

2003-06-12 Thread Tim Johnson
Original Message- From: M z [mailto:[EMAIL PROTECTED] Sent: Thursday, June 12, 2003 3:35 PM To: [EMAIL PROTECTED] Subject: misunderstanding the /g modifier on REGEX hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing ||

Re: misunderstanding the /g modifier on REGEX

2003-06-12 Thread david
M Z wrote: > hello all - > > I am trying to do the following to this data: > input: > X|YZ||A > > desired output: > X|Y| | | |Z| |A > > simply replacing || with | | > whereever it may occur in the string. > > This bit of code doesn't seem to do all of the job. > > What is wrong with this

misunderstanding the /g modifier on REGEX

2003-06-12 Thread M z
hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing || with | | whereever it may occur in the string. This bit of code doesn't seem to do all of the job. What is wrong with this code? while (<>) { while($_ =~ /([|])([|

misunderstanding the /g modifier on REGEX

2003-06-12 Thread M z
hello all - I am trying to do the following to this data: input: X|YZ||A desired output: X|Y| | | |Z| |A simply replacing || with | | whereever it may occur in the string. This bit of code doesn't seem to do all of the job. What is wrong with this code? while (<>) { while($_ =~ /([|])([|