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!

How this regex is working ?

AS08May 23 2022

Hi All,
Please refer below examples -
When i am doing

  1. select regexp_substr('P/HOO/282/KWE/08/LATE TO LAND OR NO SHOW','(^|/)([^/]*)+(\s) (\S*).*') from dual;
    This is the correct O/p that i am getting - LATE TO LAND OR NO SHOW
    Now, when i am doing same for the below text it's giving below output.
  2. select regexp_substr('H/12/JHS/DSRP/UNKOWN/UNKOWN', '(^|/)([^/]*)+(\s)(\S*).*') from dual;
    O/p - null; -- The output i want is this /DSRP/UNKOWN/UNKOWN

Why the expression is not working for the 2 example as it is working for the 1 example ?
Also, Can anyone also explain this expression - '(^|/)([^/]*)+(\s) (\S*).*)

Please advise !

Thanks

This post has been answered by Paulzip on May 24 2022
Jump to Answer

Comments

Post Details

Added on May 23 2022
9 comments
164 views