DB2 regexp in select clause
Thursday, 19. March 2009, 18:10:12
How to use regular expressions in a DB2 select query?
The simple answer is you can't. But if you are very insistent you can acheive that.
A lot of RDBSes have built in support for regular expressions, why doesn't DB2 has one? I have no idea.
In MySQL you do REGEXP, NOT REGEXP or RLIKE. here is another link.
In Microsoft SQL Server 2000 you call xp_pcre. In Microsoft SQL Server 2005 you call integrated .NET Regex classes from .
In PostgreSQL you call the regexp functions, here is another link.
For Oracle here we have a bunch of resources: First, second and also on regular-expressions.info
If you'll do a search on DB2 regexp you will stumbled upon this IBM article:
http://www.ibm.com/developerworks/data/library/techarticle/0301stolze/0301stolze.html
Which I found very interesting.
The simple answer is you can't. But if you are very insistent you can acheive that.
A lot of RDBSes have built in support for regular expressions, why doesn't DB2 has one? I have no idea.
In MySQL you do REGEXP, NOT REGEXP or RLIKE. here is another link.
In Microsoft SQL Server 2000 you call xp_pcre. In Microsoft SQL Server 2005 you call integrated .NET Regex classes from .
In PostgreSQL you call the regexp functions, here is another link.
For Oracle here we have a bunch of resources: First, second and also on regular-expressions.info
If you'll do a search on DB2 regexp you will stumbled upon this IBM article:
http://www.ibm.com/developerworks/data/library/techarticle/0301stolze/0301stolze.html
Which I found very interesting.



Anonymous # 7. May 2009, 12:08
Regexp are cool, but in the databases it will not use Indexes, if you'll put it in WHERE clause I think a full-table-scan is guaranteed ;)
Oleak in inglish sh eo ;D C'été pas mal quand même ;) Poliglot total ;o)
freejerk # 26. June 2009, 14:36