Finding the Position of Substrings Using REGEXP_INSTR

Published September 21, 2025 By Sai Sree Ram Gundepudi

Use REGEXP_INSTR to locate the starting position of tokens like PO:

SELECT REGEXP_INSTR(REPLACE('INV#8674767JSDEPOSIT PO12345678','#',''), 'PO') AS pos
FROM dual;

This gives the exact index of where PO occurs, useful when dynamically slicing strings.

Was this solution helpful?

Your feedback helps improve our technical knowledge repository.

Share this article