# hyperTTS - Text Replacement Rules - How to remove a single letter?

**URL:** <https://forums.ankiweb.net/t/hypertts-text-replacement-rules-how-to-remove-a-single-letter/51954>\
**Category:** Add-ons\
**Created:** [November 14, 2024, 9:53pm UTC](https://forums.ankiweb.net/t/hypertts-text-replacement-rules-how-to-remove-a-single-letter/51954 "2024-11-14T21:53:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oino](https://avatars.discourse-cdn.com/v4/letter/o/c37758/32.png) [@Oino](https://forums.ankiweb.net/u/Oino)\
**Post date:** [November 14, 2024, 9:53pm UTC](https://forums.ankiweb.net/t/hypertts-text-replacement-rules-how-to-remove-a-single-letter/51954/1 "2024-11-14T21:53:39Z")

</div>

Hello,

I’m using hyperTTS for my vocabulary cards. Since not everything that is on the card should be spoken, I’m using the Text Replacement Rules. I have a problem when individual letters should not be output, such as f for feminine or m for masculine. E.g. “la signora f”. When I create a “Simple Rule” with Pattern “f” and Replacement " ", the f disappears in all words. Can someone help me how to solve this problem?

Thanks!

---

<div class="post-metadata">

**Author:** ![jcznk](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/jcznk/32/15215_2.png) [@jcznk](https://forums.ankiweb.net/u/jcznk)\
**Post date:** [November 14, 2024, 10:27pm UTC](https://forums.ankiweb.net/t/hypertts-text-replacement-rules-how-to-remove-a-single-letter/51954/2 "2024-11-14T22:27:57Z")

</div>

Try using this text replacement rule:

- Type: Regex
- Pattern: `^(.*?) \D$`
- Replacement: `\1`

* * *

Brief explanation:

- `^` asserts the position at the start of a line.
- `( )` defines a capturing group, which captures the part of the string matched inside the parentheses.
- `.` matches any character (except line terminators).
- `*?` is a lazy quantifier that matches the preceding token zero or more times, but as few times as possible.
- `\D` matches any character that is not a digit.
- `$` asserts the position at the end of a line.
- `\1` in the replacement pattern inserts the content captured by the first capturing group (the text matched inside `(.*?)`).

For more info, see [https://regex101.com/](https://regex101.com/), which is very useful for testing purposes, and also [regex - Rust](https://docs.rs/regex/1.3.9/regex/#syntax), for documentation.

---

<div class="post-metadata">

**Author:** ![Oino](https://avatars.discourse-cdn.com/v4/letter/o/c37758/32.png) [@Oino](https://forums.ankiweb.net/u/Oino)\
**Post date:** [November 17, 2024, 9:01pm UTC](https://forums.ankiweb.net/t/hypertts-text-replacement-rules-how-to-remove-a-single-letter/51954/3 "2024-11-17T21:01:56Z")

</div>

Many thanks for your response. I had no experience with regular expression  
rules before. I’ve dealt with it a bit now. I’ve adapted your suggestion slightly because I only want to remove the letters m and f. The following seems to work for me:

- Type: Regex
- Pattern: ^(.\*?)[\s(?fm]$
- Replacement: \1
