1

Any idea on what would be the right function in Postgres to convert the Oracle Pattern Matching Regular Expression REGEXP_EXP ? I'm converting the source code from Oracle to Postgres,

ORACLE

IF REGEXP_LIKE(j.TRK, '^[0-9]+$') THEN

For Postgres we are using the following code,

IF aws_oracle_ext.regexp_like(j.trk, '^[0-9]+$') THEN

I need something native to Postgres without Oracle Extensions.

3
  • 2
    Use the ~ operator in Postgres Commented Nov 1, 2018 at 17:41
  • POSIX Regular Expressions Commented Nov 1, 2018 at 17:59
  • if j.trk ~ '^[0-9]+$' then... Commented Nov 2, 2018 at 11:09

1 Answer 1

2

Postgresql has an operator for that ~ . This operator maps to the internal function textregexeq(), which you may also use explicitly if you want to keep your existing syntax.

The internal function is defined as:

boolean pg_catalog.textregexeq(text, text)
IMMUTABLE PARALLEL SAFE STRICT
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.