RE: ereg_replace help wanted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux