# format_sub

- **Language:** C
- **Kind:** function
- **Source:** https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/format.c#L4526
- **Page:** https://libtmux.org/en/tmux/3.7c/reference/c-function-format-c-format_sub/

```c
static char * format_sub(struct format_modifier *fm, const char *text, const char *pattern, const char *with)
```

## Parameters

- `fm` (`struct format_modifier *`)
- `text` (`const char *`)
- `pattern` (`const char *`)
- `with` (`const char *`)

## Called by

- [`format_replace`](/en/tmux/3.7c/reference/c-function-format-c-format_replace/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/format.c#L5540)

## Calls

- [`regsub`](/en/tmux/3.7c/reference/c-function-regsub/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/format.c#L4534)
- [`xstrdup`](/en/tmux/3.7c/reference/c-function-xstrdup/) (function) [Call site](https://github.com/tmux/tmux/blob/e476c1230b958df0cb12977517d24b3dc931375b/format.c#L4536)

## Referenced declarations

- [`format_modifier.argc`](/en/tmux/3.7c/reference/c-struct-format_modifier-argc/) (attribute)
- [`format_modifier.argv`](/en/tmux/3.7c/reference/c-struct-format_modifier-argv/) (attribute)
- [`format_modifier`](/en/tmux/3.7c/reference/c-struct-format_modifier/) (struct)
