I have the following sample data for a particular column symbol for sample table.
(Update:) The data is not in a regular pattern. Number may occur at any place in be
CREATE OR REPLACE FUNCTION pad_numbers(text)
RETURNS text AS
$BODY$
SELECT regexp_replace(
regexp_replace(
regexp_replace(
regexp_replace(
$1,
E'(^|\\D)(\\d{1,3}($|\\D))', E'\\1000\\2', 'g'
), E'(^|\\D)(\\d{4,6}($|\\D))', E'\\1000\\2', 'g'
), E'(^|\\D)(\\d{7}($|\\D))', E'\\100\\2', 'g'
), E'(^|\\D)(\\d{8}($|\\D))', E'\\10\\2', 'g'
);
$BODY$
LANGUAGE 'sql' VOLATILE;
select symbol from sample order by pad_numbers(symbol) asc