> For the complete documentation index, see [llms.txt](https://anton-veselskyi.gitbook.io/codding-problems-solutions/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anton-veselskyi.gitbook.io/codding-problems-solutions/codewars/7-kyu/sql-regex-string-to-table.md).

# SQL: Regex String to Table

## [SQL: Regex String to Table](https://www.codewars.com/kata/59413d53f5c3947364000016)

You are given a table 'random\_string' that has the following format:

&#x20;**random\_string schema**&#x20;

* text

The text field holds a single row which contains a random string.

Your task is to take the random string and split it on each vowel (a, e, i, o, u) then the resultant substrings will be contained in the output table, formatted as:

&#x20;**output table schema**&#x20;

* results

Note that the vowels should be removed.

If there are no vowels, there will only be one row returned. Where there are multiple vowels in succession, you will see empty rows. A row should ebe created on each break, whether there is content in the row or not.

Regex is advised but not mandatory.

## Solutions

### 🗃️ Sql

```sql
SELECT * FROM 
unnest( regexp_split_to_array( (select text from random_string), '[aeiou]' ) )
as results;
```
