Ignore Children of a Page in Sitemap

I followed these instructions Sitemap | Kirby CMS and managed to ignore certain pages:
'sitemap.ignore' => ['error','txt', 'datenschutzerklaerung', 'preise'],

Unfortunately, this doesn’t automatically apply to subpages, such as those under ‘txt’.
I tried sitemap.ignore' => ['error','txt', 'txt/*', 'privacy-policy', 'prices'] but it doesn’t work. What’s possibly wrong?

<?= '<?xml version="1.0" encoding="utf-8"?>'; ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <?php foreach ($pages as $p): ?>
-       <?php if (in_array($p->uri(), $ignore)) continue ?>
+       <?php foreach ($ignore as $ignored): ?>
+          <?php if ($p->uri() === $ignored || str_starts_with($p->uri(), $ignored . '/')) continue 2 ?>
+      <?php endforeach ?>

        <url>
            <loc><?= html($p->url()) ?></loc>
            <lastmod><?= $p->modified('c', 'date') ?></lastmod>
            <priority><?= ($p->isHomePage()) ? 1 : number_format(0.5 / $p->depth(), 1) ?></priority>
        </url>
    <?php endforeach ?>
</urlset>

and

sitemap.ignore' => ['error','txt', 'txt/', 'privacy-policy', 'prices'] (no /*, just /)

Thank you so much. I need ‘txt’, but not ‘txt/’. How can I achieve that? If I set sitemap.ignore' => ['error', 'txt/', 'privacy-policy', 'prices'] than ‘txt’ is also ignored.

use a regex search instead of the str_starts_with.

Thank. I appreciate the hint.
Found an easier to read solutiion without writing to much in the config file:

<?= '<?xml version="1.0" encoding="utf-8"?>'; ?>
<urlset xmlns=" http://www.sitemaps.org/schemas/sitemap/0.9 ">
<?php $sitemappages = $pages->filterBy('intendedTemplate', 'not in', \[
    'news-item',
    'default',
    'error'
    \] ); ?>
<?php foreach ($sitemappages as $p): ?>

<url>
  <!-- Template: <?= $p->intendedTemplate() ?> -->
  <loc><?= html($p->url()) ?></loc>
  <lastmod><?= $p->modified('c', 'date') ?></lastmod>
  <priority><?= ($p->isHomePage()) ? 1 : number_format(0.5 / $p->depth(), 1) ?></priority>
</url>

<?php endforeach ?>
</urlset>