RE: [Perl-unix-users] Some help with strings

2004-04-05 Thread Elston, Jeremy
nday, April 05, 2004 7:46 AM To: [EMAIL PROTECTED] Subject: [Perl-unix-users] Some help with strings Hello All, I have a string that has got 123|4|||5 What I need it in is 1|2|3|4|5 I have tried $string =~ s/\||/\|/g; and i get this as a result |1|2|3||45| what am

RE: [Perl-unix-users] Some help with strings

2004-04-05 Thread Gerber, Christopher J
-Original Message- I have a string that has got 123|4|||5 What I need it in is 1|2|3|4|5 I have tried $string =~ s/\||/\|/g; and i get this as a result |1|2|3||45| --- Johnno, I'll give you the two part answer: 1) Your regex matches on

RE: [Perl-unix-users] Some help with strings

2004-04-05 Thread Matt Schneider
: [EMAIL PROTECTED] Subject: [Perl-unix-users] Some help with strings Hello All, I have a string that has got 123|4|||5 What I need it in is 1|2|3|4|5 I have tried $string =~ s/\||/\|/g; and i get this as a result |1|2|3||45| what am i doing wrong? Mnay Thanks, Johnno

Re: [Perl-unix-users] Some help with strings

2004-04-05 Thread Kester Allen
Hi Johnno-- You can use '+' in a regex to mean 'one-or-more', so s/\|+/|/ would mean "replace one or more pipe with a single pipe" (you don't need to escape the pipe in the replacement string). As a style matter, you can enclose the pipe in a chacter class with []s to make it easier to read:

Antwort: [Perl-unix-users] Some help with strings

2004-04-05 Thread Georg . Mavridis
Hi John, You forgot at least a backslash, $string =~ s/\|+/\|/g; Should do the job. HTH George ___ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: [Perl-unix-users] Some help with strings

2004-04-05 Thread Stacy Doss
uting backslash Try This is what I think you want $string =~ s/\|+/\|/g; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Johnno Sent: Monday, April 05, 2004 9:46 AM To: [EMAIL PROTECTED] Subject: [Perl-unix-users] Some help with strings Hello All, I have a

RE: [Perl-unix-users] Some help with strings

2004-04-05 Thread James Schappet
April 05, 2004 10:46 AM To: [EMAIL PROTECTED] Subject: [Perl-unix-users] Some help with strings Hello All, I have a string that has got 123|4|||5 What I need it in is 1|2|3|4|5 I have tried $string =~ s/\||/\|/g; and i get this as a result |1|2|3||45| what am i doing

[Perl-unix-users] Some help with strings

2004-04-05 Thread Johnno
Hello All, I have a string that has got 123|4|||5 What I need it in is 1|2|3|4|5 I have tried $string =~ s/\||/\|/g; and i get this as a result |1|2|3||45| what am i doing wrong? Mnay Thanks, Johnno ___ Perl-Unix-Users ma