> For the complete documentation index, see [llms.txt](https://lauradang.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lauradang.gitbook.io/notes/python/regex.md).

# Regex

```python
import re

regex = r"(?P<variable>.*) \#(?P<variable_2>\d+)"
match = re.search(regex, "something #2")

variable = match.group("variable")
variable_2 = match.group("variable_2")
```
