# Regular Expression

*noun*

say it: **“REJ-eks”** **/ˈrɛdʒɛks/** or **“REG-yuh-ler ik-SPRESH-un”** **/ˈrɛɡjələr ɪkˈsprɛʃən/**

A pattern that describes the shape of some text, such as letters, then a dash, then digits, used to search for or test text.

## What is a **regular expression** in PowerShell?

A **regular expression** is a pattern that describes the shape of text instead of exact words. `\d` is any digit, `+` means one or more, `[A-Z]` is any capital letter, and `^` and `$` are the start and end. `-match` and `Select-String` both take one, so `[A-Z]+-\d+` finds order numbers such as TM-48213.

```powershell
'paid order TM-48213' -match '[A-Z]+-\d+'   # True
$Matches[0]                                    # TM-48213
```

## In a sentence

- “Maya built the **regular expression** a piece at a time, testing it with -match after each piece.”
- “The **regular expression** \[A-Z\]+-\\d+ found every order number in the notes, whatever its digits.”

Level: Journeyman · [More PowerShell terms at this level](https://www.ask-codey.com/glossary?category=powershell&level=3)

Updated: November 10, 2026

## In other subjects

- [Regular Expression in C#](https://www.ask-codey.com/glossary/regular-expression-c-sharp)
- [Regular Expression in Java](https://www.ask-codey.com/glossary/regular-expression-java)
- [Regular Expression in JavaScript](https://www.ask-codey.com/glossary/regular-expression-javascript)
- [Regular Expression in Python](https://www.ask-codey.com/glossary/regular-expression)

Source: https://www.ask-codey.com/glossary/regular-expression-powershell
