By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,226 Members | 1,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,226 IT Pros & Developers. It's quick & easy.

String matching in LIKE predicate...

P: n/a
Is there any way I can specify a regex-like expression in the LIKE part
of a WHERE clause?

Something to the tune of:

'#+-#+'

(# is a number, + is one or more, - is a -)

Not specifically what I'm after, but it explains my point. My most
important to note is that I'd like to be able to match for a few
potential sequences of numbers.

I've found some regex extensions for DB2, sadly they are not an option
for me.

- Alexander Trauzzi

May 8 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
.... not necessary in the LIKE part.

SELECT str
FROM strTable
WHERE regex1('\d+-\d+', str) = 1
Look at the Knut's implementation of regexp:

http://www-128.ibm.com/developerwork...301stolze.html

-- Artur Wronski

May 8 '06 #2

P: n/a
"I've found some regex extensions for DB2, sadly they are not an option

for me."

May 10 '06 #3

P: n/a
at******@gmail.com wrote:
"I've found some regex extensions for DB2, sadly they are not an option
for me."


Why not?

p.s: The article also explains in the introductory part how you can sort-of
achieve the same results with plain SQL.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 10 '06 #4

P: n/a
I am a developer and I don't have control over the DB2 installation.
DB2's "LIKE" clause is contemptfully weak.

- Alex

May 11 '06 #5

P: n/a
at******@gmail.com wrote:
I am a developer and I don't have control over the DB2 installation.
DB2's "LIKE" clause is contemptfully weak.


Then my recommendation would be to talk to your DBA.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 12 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.