How can I search and replace text within a song?

How can I search and replace text within a song?

OnSong gives you powerful editing tools for making changes to your song files. To do this, we will use the Song Editor.

Navigate to the song you'd like to do this to in OnSong. Then tap on the pencil icon in the Menubar to open the Song Editor. Next, tap on the hammer icon in the Song Editor Menubar to open the Text Tools Menu. Locate the Search and Replace section.  We can start by simply entering in a left parentheses ( in the search field and a right bracket [ in the replace field and then tap on the Perform Search/Replace button.  We can then repeat this by typing in a right parentheses ) and then a right bracket ] and repeating the search and replace.  Since square bracketed denote chords in the OnSong and ChordPro file formats, you can then change the Chord Format in this same menu.

The search and replace field is also able to use more powerful search and replace scripts using regular expressions. These almost magical spells are only to be truly understood by programmers, but we will give an example here to demonstrate some more powerful tools.  Instead of performing multiple search and replace scripts, you could type the following the search field: /\((.+?)\)/

Then type this in the replace field: [$1]

This will also search and replace chords surrounded by parenthesis with the same chords surrounded by square brackets. This works because OnSong recognizes the text is a regular expression because it is surrounded by forward slashes. The backslashes are used to "escape" the otherwise special characters (parenthesis and brackets).  The second set of parenthesis finds the text we want to use the replace field and the characters in-between the parenthesis means (any character, one or more, and be non-greedy).  Then the $1 in the replace moves the captured text into position. I know, it's an ancient and mystical language and you can learn more if you choose.