Substring question

From: Adam Witney <awitney(at)sghms(dot)ac(dot)uk>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Substring question
Date: 2004-12-13 18:17:27
Message-ID: BDE38D37.3D6A8%awitney@sghms.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I am trying to select a part of a text field based on a regular expression,
the data looks like this

Rv0001c_f
Rv0002_r
Rv1003c_r

Etc

I would like to be able to select like this (this is a regular expression I
would do in perl)

SELECT substring(primer_name, '(\w+)\d\d\d\d[c]*_[fr]$') from primer;

Is it possible to do this in SQL?

Thanks for any help

adam

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Igor Shevchenko 2004-12-13 18:18:57 partial index on boolean, problem with v8.0.0rc1
Previous Message Scott Marlowe 2004-12-13 17:39:38 Re: subscribe missing?