John, I think you've missed my point. I'm currently 'exploding' by ',' to give me sub ranges and then 'exploding' the subtranges by '-' to get the actual start and end, adding the subtotals up for the page count. The problem is that I want to be able to replace the different types of '-' that can come through, without knowing what they might be using. 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). Cheers George > -----Original Message----- > From: Asendorf, John [mailto:jasendorf@xxxxxxxxxxx] > Sent: 29 September 2004 3:43 pm > To: George Pitcher; php-windows@xxxxxxxxxxxxx > Subject: RE: ereg_replace help wanted > > > 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----- > From: George Pitcher [mailto:george.pitcher@xxxxxxxxxxx] > Sent: Wednesday, September 29, 2004 9:46 AM > To: php-windows@xxxxxxxxxxxxx > Subject: ereg_replace help wanted > > > Hi, > > I don't want to spend a lot of time leaning how to use this function but I > have a problem that I think it can solve. > > I have a web form that allows the user to (amongst other things) submit a > pagerange to my database. Using '-' and ',' as separators, I am able to > calculate the number of pages being submitted. > > I can handle roman or arabic numerals and a typical range might look like: > 'ix-xxvii,21-30,64' and that would usually give me a page count of 30. > > 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 anyone suggest a filter that will handle my hyphens correctly, > regardless of what type of hyphen the user is entering? > > MTIA > > George in Oxford > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php