# Pipe-Separated Values

Key: `container.array.pipe_separated`

List separated by pipe character: value1\|value2\|value3. Similar to CSV but uses pipe as delimiter.

Page: <https://meridian.online/docs/projects/finetype/types/container/array/pipe_separated>

Samples: `apple|banana|cherry`, `1|2|3|4|5`

## Background

### Origin

FineType defines pipe-separated values as its own type, labelled container.array.pipe\_separated, for a list held in a single value with the elements separated by the pipe character, as in value1\|value2\|value3.[[1]](https://github.com/meridian-online/finetype/blob/main/labels/definitions_container.yaml) FineType's definition describes the type as similar to CSV but using the pipe as the delimiter.[[1]](https://github.com/meridian-online/finetype/blob/main/labels/definitions_container.yaml) FineType's validation pattern for the type, ^\[^\|\]+(\\\|\[^\|\]+)\*$, requires every element between pipes to be non-empty.[[1]](https://github.com/meridian-online/finetype/blob/main/labels/definitions_container.yaml)

The pipe belongs to a wider family of delimiter-separated values, where any character may separate values.[[2]](https://en.wikipedia.org/wiki/Delimiter-separated_values) Wikipedia lists the vertical bar, also known as the pipe, among the more commonly used separators, alongside the comma, tab, colon and space.[[2]](https://en.wikipedia.org/wiki/Delimiter-separated_values)

### Use

Delimiter collision happens when the delimiter character appears inside a value without any accommodation, so that one logical value is split into two.[[2]](https://en.wikipedia.org/wiki/Delimiter-separated_values) Some delimiter-separated conventions simply disallow the delimiter inside a value, while others provide a way to embed it.[[2]](https://en.wikipedia.org/wiki/Delimiter-separated_values) Before splitting, check whether any element could itself contain a pipe, and find out from the producer how such a pipe would be written. (Meridian's view)

Python's re documentation says that to match a literal pipe you write \\\| or enclose it in a character class, as in \[\|\].[[3]](https://docs.python.org/3/library/re.html) Split on the pipe as a literal string where you can, and escape it whenever a regular expression is involved. (Meridian's view)

### Where you'll meet it

The GroupLens MovieLens ml-latest-small dataset stores each film's genres in movies.csv as a pipe-separated list.[[4]](https://files.grouplens.org/datasets/movielens/ml-latest-small-README.html) The MovieLens ml-latest-small README lists (no genres listed) among the values the genres are selected from.[[4]](https://files.grouplens.org/datasets/movielens/ml-latest-small-README.html) Treat a placeholder like (no genres listed) as an empty list rather than a genre before counting or exploding the genres. (Meridian's view)

## Sources

1. [finetype/labels/definitions\_container.yaml at main · meridian-online/finetype](https://github.com/meridian-online/finetype/blob/main/labels/definitions_container.yaml) — FineType
2. [Delimiter-separated values - Wikipedia](https://en.wikipedia.org/wiki/Delimiter-separated_values) — secondary source
3. [re — Regular expression operations](https://docs.python.org/3/library/re.html) — documentation
4. [ml-latest-small-README.html](https://files.grouplens.org/datasets/movielens/ml-latest-small-README.html) — dataset
