rw263
asked on
RegEx
I have a string containing: $to = "$a,$b,$c,$d,$e".
$a through $e contain multiple email addresses separated by commas, no space in te $to line.
If $a is present then the initial value of the $to would be: $to = ",email1@place,com,....."
I tried:
$to =~ s/^,//;
$to =~ s/,,/,/;
Which seems to work however, if the string is $to = ",b,c,,,", it will return $to = "b,c,," not $to = "b,c"
Any ideas?
I even tried: $to =~ s/,+/,/;
Thanks!
$a through $e contain multiple email addresses separated by commas, no space in te $to line.
If $a is present then the initial value of the $to would be: $to = ",email1@place,com,....."
I tried:
$to =~ s/^,//;
$to =~ s/,,/,/;
Which seems to work however, if the string is $to = ",b,c,,,", it will return $to = "b,c,," not $to = "b,c"
Any ideas?
I even tried: $to =~ s/,+/,/;
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
(but be aware that "," is a valid character in an email name)
ASKER
wonder why mine didn't work, but this does. thanks ozo!