## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> REGEXP_SUBSTR[REGEXP_SUBSTR]:::quoted
REGEXP_SUBSTR --> End((END))
```
## Purpose
The `REGEXP_SUBSTR` SQL function extracts a substring from the given value using regular expression. The regular expression must follow the Microsoft.net regular expression language.
See also [[REGEXP_INSTR]] and [[REGEXP_REPLACE]].
Parameters:
- Input (`varchar2`): the text to get the substring from.
- Pattern (`varchar2`): regular expression pattern.
- Start position (optional, `int32`): the start index from the input. Defaults to `1`.
- Appearance (optional, `int32`): indicating the appearance of the substr operation. Defaults to `1`.
- Match_parameter (optional, `varchar2`): a text literal that lets you change the default matching behaviour of the function. Defaults to `''`.
Returns: the substring from the input.
## Examples
The following example retrieves the first word of a text:
```sql
select regexp_substr('Invantive is a company name', '^(\S*)')
-------------------
Invantive
```
The following example retrieves the first two consecutive digits:
```sql
select regexp_substr('2, 5, and 10 are numbers', '(\d)(\d)')
-------------------
10
```
The following example retrieves the second vowel, ignoring case:
```sql
select regexp_substr('INVANTIVE', 'a|e|i|o|u', 1, 2, 'i')
-------------------
A
```