Thanks to all who chipped in.
I'm going with John Asendorf's '$pages = ereg_replace ( "[^0-9cdilmvx,]" ,
"-" , $pages);' which works for me.
Tom wrote:
> But do you really want an "A" (etc.) to be considered a dash?
Yes, because it is not a valid pagerange character.
Cheers, and thanks for sav
On 29 Sep 2004 George Pitcher wrote:
> In short I'm looking to search for any character that is NOT one of the
> following:
>
> "0-9 cdilmvx ," and replace it with '-' [chr(45)] (I do an initial strip of
> spaces at the beginning of the process).
Try something like:
$newstring = preg_re
acter that is NOT one of the
following:
"0-9 cdilmvx ," and replace it with '-' [chr(45)] (I do an initial strip of
spaces at the beginning of the process).
Cheers
George
-Original Message-
From: Asendorf, John [mailto:[EMAIL PROTECTED]
Sent: 29 September 2004 3:43 pm
of
spaces at the beginning of the process).
Cheers
George
> -Original Message-
> From: Asendorf, John [mailto:[EMAIL PROTECTED]
> Sent: 29 September 2004 3:43 pm
> To: George Pitcher; [EMAIL PROTECTED]
> Subject: RE: [PHP-WIN] ereg_replace help wanted
>
>
> Act
Actually, what you need is split() by the sounds of it. Spliting the groups of pages
by ',' would give you an array of either single pages or ranges of pages. From there,
it is just a matter of mathematics to take the pieces of the new array and adding them
together.
-Original Message
On 29 Sep 2004 George Pitcher wrote:
> The problem is that I think that some of my users are pasting the range in,
> rather than re-typing (I don't really want to stop them from pasting) and I
> am sure that sometimes the '-' is coming over as something other than a
> conventional hyphen.
>
> Can