467,189 Members | 1,318 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,189 developers. It's quick & easy.

String matching in LIKE predicate...

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
  • viewed: 1691
Share:
5 Replies
.... 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
"I've found some regex extensions for DB2, sadly they are not an option

for me."

May 10 '06 #3
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
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
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.

Similar topics

5 posts views Thread by oliver | last post: by
1 post views Thread by Thomas Matthews | last post: by
9 posts views Thread by bullockbefriending bard | last post: by
9 posts views Thread by shapper | last post: by
reply views Thread by govindrjujare@gmail.com | last post: by
11 posts views Thread by tech | last post: by
reply views Thread by Maric Michaud | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.