On 7/7/06, T E Schmitz <[EMAIL PROTECTED]> wrote:
Sorry, but that would also capture something like
10-30-59mm
The pattern describes either a single length (120 millimeters) or a
range (30 to 70 millimetres), hence:
\\d+(-\\d+)?mm
The ? quantifier refers to the combination of '-' and digits and has to
be bracketed.
...
Still, I'd be interested to know whether there is a 'more elegant' solution.
OK, last try using regex:
SELECT
NAME
, substring(NAME, '^(\\d+(-\\d+)?mm)') AS BASE_NAME
, regexp_replace(NAME, '^\\d+(-\\d+)?mm (.*)', '\\2') AS SUFFIX
FROM MODEL
Regards,
Rodrigo
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org