### Bug description

I'm using Quarto v1.3.222 on macOS 13.2.1.

The simplest example I could find is a Jupyter notebook with a single cell with source:

```py
print("{[}")
```

Then run `quarto render` and hit the error:

```
Error running Lua:
/Applications/quarto/share/filters/qmd-reader.lua:83: malformed pattern (missing ']')
stack traceback:
        /Applications/quarto/share/filters/qmd-reader.lua:83: in function 'escape_invalid_tags'
        /Applications/quarto/share/filters/qmd-reader.lua:96: in function 'Reader'
```

Adding a `]` after the `[` doesn't help.

I encountered this while displaying the following dictionary:

```py
{'cells': [], 'metadata': {}, 'nbformat': 4, 'nbformat_minor': 5}
```

### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cscheid
2023-02-25T07:16:48Z
seeM
bug
closed
Lua error when cell output contains square brackets in braces
https://github.com/quarto-dev/quarto-cli/issues/4535