By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| REGEXP_SUBSTR(TD.INPUT,'S9C[0-9]{8}(|$)',1,GREATEST(1,REGEXP_COUNT(TD.INPUT,'S9C[0-9]{8}(|$)'))) |
|---|
| null |
| null |
| S9C00019171 |
| S9C10204555 |
| REGEXP_SUBSTR(TD.INPUT,'S9C[0-9]{8}(|$)',1,GREATEST(1,REGEXP_COUNT(TD.INPUT,'S9C[0-9]{8}(|$)'))) |
|---|
| null |
| null |
| S9C00019171 |
| S9C10204555 |