Regular expressions are a pain. Jan Goyvaerts’ RegEx Reference helps.
In a related tip, the following will eliminate any non-numeric components in a string: ereg_replace(“[^0-9]”, “”, $string) . I guess I’ll have to admit that I’d not used the exclusion operator before (the carrot immediately following a square bracket). Now I know.