# Using regex in the zero plugin, syntax error?

**URL:** <https://discourse.beets.io/t/using-regex-in-the-zero-plugin-syntax-error/2416>\
**Category:** Help\
**Created:** [October 5, 2023, 1:39am UTC](https://discourse.beets.io/t/using-regex-in-the-zero-plugin-syntax-error/2416 "2023-10-05T01:39:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chriscrutch](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@chriscrutch](https://discourse.beets.io/u/chriscrutch)\
**Post date:** [October 5, 2023, 1:39am UTC](https://discourse.beets.io/t/using-regex-in-the-zero-plugin-syntax-error/2416/1 "2023-10-05T01:39:45Z")

</div>

I’m trying to use the Zero plugin to blank out all the genre tags in my library that are NOT set to “christmas”. In my configuration file I have enabled the plugin, put a configuration section for it in, and have this line:

```auto
genre: [^(?!christmas).*]

```

When I go to run beets again, just a query to start, it returns with the following error:

```auto
configuration error: /home/username/.config/beets/config.yaml could not be read: while parsing a flow sequence
  in "/home/username/.config/beets/config.yaml", line 23, column 12
expected ',' or ']', but got '?'

```

Can I not use lookaround regex in beets?

---

<div class="post-metadata">

**Author:** ![jackwilsdon](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/jackwilsdon/32/10_2.png) [@jackwilsdon](https://discourse.beets.io/u/jackwilsdon)\
**Post date:** [October 5, 2023, 10:55am UTC](https://discourse.beets.io/t/using-regex-in-the-zero-plugin-syntax-error/2416/2 "2023-10-05T10:55:25Z")

</div>

Interestingly that is technically valid YAML, even though at a glance I’d have said it’s probably not right.

Could you try quoting the field like so and see if that fixes it?

```yaml
genre: '[^(?!christmas).*]'

```

---

<div class="post-metadata">

**Author:** ![jackwilsdon](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/jackwilsdon/32/10_2.png) [@jackwilsdon](https://discourse.beets.io/u/jackwilsdon)\
**Post date:** [October 5, 2023, 10:58am UTC](https://discourse.beets.io/t/using-regex-in-the-zero-plugin-syntax-error/2416/3 "2023-10-05T10:58:49Z")

</div>

[https://yaml-online-parser.appspot.com/](https://yaml-online-parser.appspot.com/) seems to treat it as invalid (which uses `pyyaml` behind the scenes like beets), even though most other sites/parsers don’t have a problem with it. It seems like the issue it has is specifically with question marks: [Allow question marks inside of plain scalars in flow collections · Issue #128 · yaml/pyyaml · GitHub](https://github.com/yaml/pyyaml/issues/128)

---

<div class="post-metadata">

**Author:** ![chriscrutch](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@chriscrutch](https://discourse.beets.io/u/chriscrutch)\
**Post date:** [October 5, 2023, 3:42pm UTC](https://discourse.beets.io/t/using-regex-in-the-zero-plugin-syntax-error/2416/4 "2023-10-05T15:42:12Z")

</div>

Quoting it got rid of the error message, and after some testing the plugin is working as I expect now. Thank you @jackwilsdon
