Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

in regular expression difference between \z and \Z

Mustafa KALAYCIMay 7 2018 — edited May 7 2018

Hello everyone,

I would like to understand difference between lower and capital z with backslash. documentation says: https://docs.oracle.com/cd/B28359_01/appdev.111/b28424/adfns_regexp.htm#CHDBCCDJ

\Z (capital Z)

Only at the end of string or before a newline ending a string. In multi-line mode, that is, when embedded newline characters in a string are considered the termination of a line, \Z does not match the end of each line.

\z (lowercase z)

Only at the end of a string.

so please correct me if I am wrong, \Z should be pointing end of every line in multiline mode.

Select regexp_substr('Oracle' ||chr(10) || 'DB', '.\z',1,1,'m') lowercase_z,

       regexp_substr('Oracle' ||chr(10) || 'DB', '.\Z',1,1,'m') uppercase_Z

from dual;

but they both returns B. I would expect \Z should return "e" of "Oracle"

thanks.

This post has been answered by Etbin on May 7 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 4 2018
Added on May 7 2018
10 comments
1,447 views