# Set route types from callsigns with regex

https://docs.vamsys.co.uk/guides/regex-flight-type/

> Use regular expressions in Google Sheets to fill the Type and Flight Type columns of a routes import.

Last updated: 2026-11-27

Many Virtual Airlines use a callsign system where the pattern tells you the kind of flight: a short code for scheduled flights, four digits for charters, a trailing letter for repositioning. If your routes are in a spreadsheet, a regular expression (regex) can read that pattern and fill the columns the routes import needs, so you don't set them by hand.

This guide uses Google Sheets. The examples use made-up callsigns. Change the patterns to match your own system.

## The two columns {#columns}

The routes import has two columns that describe a flight's kind. Both come from the Routes export, so export your routes first. See [Import & Export](https://docs.vamsys.co.uk/import-export/import-export.md).

| Column              | Accepted values                                                                    |
| ------------------- | ---------------------------------------------------------------------------------- |
| **Type** (required) | `scheduled`, `cargo`, `charter`, `training`, `vfr`, `repositioning`, `jumpseat`    |
| **Flight Type**     | `s` Scheduled, `n` Non-scheduled, `g` General Aviation, `m` Military, `x` Training |

**Type** is what the route is in your Virtual Airline. **Flight Type** is the flight type sent to SimBrief. A row with any other value in either column fails to import.

## Read a callsign as a pattern {#basics}

A regex describes the shape of text instead of the text itself. Take the callsign `TVS3BD`: three letters, one digit, two letters.

- `[A-Z]{3}` is three letters from A to Z, here `TVS`.
- `\d` is one digit, here `3`.
- `[A-Z]{2}` is two letters, here `BD`.

Ranges cover callsigns of different lengths. `\d{1,2}` is one or two digits and `[A-Z]{1,2}` is one or two letters, so `[A-Z]{3}\d{1,2}[A-Z]{1,2}` matches both `TVS3BD` and `TVS56H`. A set in square brackets matches only those characters: `[FP]` is an `F` or a `P`.

Start each pattern with `^` and end it with `$`. Without them, Sheets matches a pattern anywhere in the callsign, so a mistyped `TVS3BDX` would still match the scheduled pattern.

## Patterns for the example system {#patterns}

| Pattern                       | Matches              | Type            |
| ----------------------------- | -------------------- | --------------- |
| `^[A-Z]{3}\d{3}[FP]$`         | `TVS240P`, `TVS240F` | `repositioning` |
| `^[A-Z]{3}\d{4}$`             | `TVS2240`            | `charter`       |
| `^[A-Z]{3}\d{1,2}[A-Z]{1,2}$` | `TVS3BD`, `TVS56H`   | `scheduled`     |

## Fill the columns in Sheets {#sheets}

Put your callsigns in column F. Sheets uses `REGEXMATCH(text; pattern)`, and `IFS` tries each condition in order. Depending on your locale, Sheets separates arguments with `;` or `,`.

1. Add a column called **Type** and fill it down with:

   ```text
   =IFS(REGEXMATCH(F2;"^[A-Z]{3}\d{3}[FP]$");"repositioning";REGEXMATCH(F2;"^[A-Z]{3}\d{4}$");"charter";REGEXMATCH(F2;"^[A-Z]{3}\d{1,2}[A-Z]{1,2}$");"scheduled";TRUE;"")
   ```

2. Add a column called **Flight Type**. If **Type** is in column G, fill it down with:

   ```text
   =IFS(G2="scheduled";"s";OR(G2="charter";G2="repositioning");"n";TRUE;"")
   ```

3. Check the rows where either cell is empty. Their callsigns matched none of your patterns.

4. Download the sheet as CSV and import it with **Routes** on the **Imports** tab.

The `TRUE;""` at the end is the fallback: a callsign that matches nothing gets an empty cell instead of an error.

> **Note:** During the beta, a routes import in v5.5 changes the same routes in vAMSYS v5. See [How the vAMSYS v5.5 beta works](https://docs.vamsys.co.uk/getting-started/5-5-beta.md).

## Page history

- 2026-11-27 (v5.5.0): First version for v5.5.
