[What mail client are you using? It refuses to include a Date: header]
On , [EMAIL PROTECTED] said:
>apples, oranges, pears
>
>I'd like to make it reads:
>
>apples, oranges, or pears
No need to use a regex, especially since a regex will have to go through
the whole string.
# if there is a comma, get the last one
if (($last_comma = rindex($string, ",")) != -1) {
# replace it with ", or"
substr($string, $last_comma, 1, ", or");
}
The regex to do that would be
s/,(?=[^,]*$)/, or/;
Maybe you'd like to use the regex approach, though.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]