× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Apologies if this isn't quite the correct forum for this question, but it
seems a good place to get a chance of a second opinion...

Has anyone noticed anything funny with the look around regex capabilities
of DB2 ( 7.1 )

For example

Applying

(?<!a)\d(?!a)

To

B2B

It should return

2

But it seems to find a match but with no text returned.

E.g if you run:

Select
Regexp_substr( 'B2B' , '(?<!a)\d(?!a' )
From sysibm/sysdummy1

It doesn't return null and it appears as blank in STRSQL.

whereas if you run the regex over 'a2B' you clearly get null returned.

But it should select the digit as far as I understand.

Further,

Select
Regexp_replace( 'B2B' , '(?<!a)\d(?!a', '#' )
From sysibm/sysdummy1

Will return B#2B

which seems to indicate that the regex selected the position just after the
B where the negative look behind matched, but then didn't appear to go on
and match the digit.

Does this make sense to anyone?

The regex is saying "find me a digit which doesn't have an "a" on either
side of it"

Am I missing something obvious?

Thanks,
Craig

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.