# Add predefined strings to existing fields across multiple cards

**URL:** <https://forums.ankiweb.net/t/add-predefined-strings-to-existing-fields-across-multiple-cards/18978>\
**Category:** Help\
**Created:** [April 11, 2022, 6:38am UTC](https://forums.ankiweb.net/t/add-predefined-strings-to-existing-fields-across-multiple-cards/18978 "2022-04-11T06:38:47Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kleinerpirat](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/kleinerpirat/32/19863_2.png) [@kleinerpirat](https://forums.ankiweb.net/u/kleinerpirat)\
**Post date:** [April 11, 2022, 7:06am UTC](https://forums.ankiweb.net/t/add-predefined-strings-to-existing-fields-across-multiple-cards/18978/2 "2022-04-11T07:06:06Z")

</div>

> [@rantanp](#):
>
> What is the easiest way to insert predefined strings at the beginning and end of an existing field, for a large number of cards?

[Regular expressions](https://www.regular-expressions.info/tutorial.html) (RegEx).

You can define a capturing group with parentheses and use it in the replacement with `$i`, where `i` is the index of the group within your regular expression.

For your use case, select the notes in the Browser, go to Find & Replace, select the field and “Treat input as regular expression”, then insert the following:

![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/f/f2f1f7815eefcf313bd8336a2f615738723f223d.png)

Find: `(.*)`

- translates to “Match a string of any length (as long as possible) with any characters (except newlines) and store it.”
  - to include newlines, you could use `([\S\s]*)`.

Replace: `[sound:$1]`

- references the stored group with `$i`

---

_[View the full topic](https://forums.ankiweb.net/t/add-predefined-strings-to-existing-fields-across-multiple-cards/18978)._
