ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

REGEXP_LIKE problem (with range e.g. [A-B])

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • REGEXP_LIKE problem (with range e.g. [A-B])

    Hi
    This feels like a stupid question because it should just work, so clearly I'm doing something wrong, but I have no idea what it is.
    I have a table with 3 rows, 'Alan','Ben','Charlie'
    I would expect
    Code:
    select * from mytable where regexp_like(name,'[A-B]')
    to return 2 rows, it returns none.
    regexp_like(name,'A') returns 1 row so the function does work, sometimes!
    My original problem was finding 'A[0-9]' which I managed to achieve using 'A\d', but it's very frustrating that the simple [A-B] does not work.
    I am guessing it's something to do with codepage, ccsid or something, but what?!
    We are on v7r2
    Ta
    Adrian

  • #2
    Your example works perfectly for me.

    It seems likely to be a CCSID problem where the [ and ] characters are not translating correctly. (These characters are often a problem when CCSIDs are not set up properly because they're at a different code point in different flavors of EBCDIC.) Make sure your job CCSID is set properly for your environment and for your emulator settings.

    Comment


    • #3
      Thanks Scott, you're dead right (as usual) we use the default ccsid of 65535, if I change my job to match my emulator (285) hey presto, I'm back in business...
      ta muchly

      Comment

      Working...
      X