New Hampshire Country Dance Fiddle Tunes Website

The Fiddle Tunes Collection: Tunes of New England & Related Traditions

Customizing Playable Tune Searches

Here we look at a special type of search that returns Playable Tunes in standard notation that meet the search criteria. We look at how to do it and I present a few useful searches. Click on a tab to display or hide its contents.


  • Search Overview & Useful Searches

    This section has some examples you can use as templates, some that you may find to be useful searches, and answers to some questions you might have. The remainder of this page contains fuller explanations of what's actually going on. To use these searches it would be best to read the explanation, but you should be able to do something by looking at the patterns in the searches.

    Searches all use the information fields of abc tunes (composer, key, etc.), and the searches make use of regular expressions.

    Searching with One Information Field:

    1. To find all tunes composed (C:) by Bob McQuillen: C:.*McQuillen

    2. To find all tunes associated with New Hampshire; Tune tags are in the N: field, so N:.*Hampshire

    Searching with Two Information Fields:

    1. To find all tunes composed by Bob McQuillen in the key (K:) of G: C:.*McQuillen[\s\S]*K:\W*G

    2. To find all reels in D: G:.*[rR]eel[\s\S]*K:\W*D

    Searching with Two Information Fields Where You Don’t Know Which Comes First:

    1. To find all jigs from New Hampshire (G & N fields), search in both directions: G:.*[jJ]ig[\s\S]*N:.*Hampshire|N:.*Hampshire[\s\S]*G:.*[jJ]ig

    Turning a Search into a URL or a Link:

    1. URL. Use the URL of the page, the # tag, and the search:*McQuillen

    2. Link. Enclose the URL in the <a> tag:

    <a href="*McQuillen"> Bob McQuillen Tunes </a>

    3. It would look like this and is set up to open in a new tab:

             Bob McQuillen Tunes

    To Print Your Search Results:

    Once you've opened up your search results in a browser window, just use your browser's Print command.

    Important Information Fields in Approximate Order of Usage:

    Fields given the same number might be before or after other of that number.

    1. X: Tune Number
    2. T: Title
    3. C: Composer
    4. S: Source
    6. H: History (information about the tune)
    6. M: Meter (e.g. 4/4)
    6. R: Rhythm (e.g. Reel)
    6. G: Group (e.g. Reels ~ Canadian ~ Quebec ~ LRB)
    6. N: Tune Tags (e.g. Reel, New England Repertoire, Canadian, LRB)
    7. K: Key

    Some Useful Search Templates

    Here are some examples of searches that you can use as templates for your own searches.

    1. Single-field search: no need to worry about order of fields.

      1. Composer: C:.McQuillen

      2. As hyperlink: <a href="" target="blank" > Bob McQuillen Tunes </a>

      3. Note 1: It's best to use a single word such as last name that is always the same.

      4. Note 2: The added target="blank" opens the link in a new tab.

      5. Note 3: To search on another field, change C: to the desired field (see above) and change the search term. The rest should be unchanged.

    2. Two-Field Search Where Order of Fields is Known

      1. Example: All jigs in Bb — let's use Rhythm & Key.

      2. Search: R:.[jJ]ig[\s\S]K:\WBb

      3. Hyperlink: <a href="[jJ]ig[\s\S]K:\WBb" target="_blank" > Bob McQuillen Tunes </a>

      4. Note 1: Make sure they're in the correct order. The [jJ] is to allow for the word "jig" to start with a capital or lower-case letter.

    3. Two-Field Search Where Order of Fields is Not Known

      1. Example: Marches from/associated with New Hampshire — G and N. We could have used R instead of G. Because we aren't sure of the order of fields we have to search with G first and again with N first.

      2. Search: G:.[mM]arch[\s\S]N:.Hampshire|N:.Hampshire[\s\S]G:.*[mM]arch

      3. Comments: You should be able to copy the search code into a template for a hyperlink. The vertical bar means OR.

      1. For similar searches you can use one of these as a template and substitute in the relevant search terms.

  • Basic Concepts & Single-Field Searches

    Here we look at ways of searching for tunes and getting actual tunes to return rather than just lists of tunes as you'd get from a search of the Tune Index.

    Some of the ideas and details behind custom searches are complicated, but putting together a search based on a template is often quite easy.

    How the Searches Work

    All the searches here are based on the Information Fields in the header of every tune - the title (T:), key (K:) and others.

    Searches make use of what are called regular expressions, which are sequences of characters used to define search patterns. Although often fairly complex, we will be using fairly basic patterns here.

    An Example Using One Search Term

    Suppose we want to find all the tunes by Bob McQuillen.

    We can use McQuillen as the search word; there aren't any others by that name among the composers. The composer is the C: field.

    But there is likely something between the field name and the search term (a space, or the word "Bob" for example), so in order to work we have to build that into our search.

    For that we use the term .*. A period represents any character except a new line. The asterisk says to look for 0 or more of them. So whether it's a space, two spaces, or the word "Bob", that will take care of anything that might show up between the C: and Mac’s name.

    Putting it together, here’s what we get:


    There's only one thing left: we have to tell it where to search. In this case the URL for the page with all the tunes is:

    So we enter the URL, the the # tag to tell it we want to do a search, and then our search phrase. That gives us:*McQuillen

    Try copying that line and pasting it into the address line of your web browser. Hit the Return key and it should show you several tunes: The Dancing Bear, Dave's Hornpipe, Miss Mason's Hornpipe, Olde Tyme Quadrille and several others.

    In the next section we look at searches based on two fields at the same time.

  • Searches Using Two Fields

    An Example Using Two Search Terms

    Now let's suppose we want to refine our search and only get tunes written by Bob McQuillen that are marches. A tune could be identified as a march in a couple places. As I write out abc tunes it shows up in the R: (rhythm) and G: (group) fields. It doesn't matter which one we use; let's use the R: field. Now we need to combine the following:

    C:.*McQuillen and R:.*March

    We need to get from Mac’s name to the R: field without losing the match with our search term. There are many ways to do that. As we don't really care what's in between, a good strategy is to accept everything between the name McQuillen and the R: field. Here’s how we can do it.

    There are two symbols that cover everything: \s for white space (spaces, tabs, etc.), and \S which includes everything that’s not a white space including new lines.

    To accept multiple possibilities in a search, you can put things in brackets.

    Thus [\s\S] will accept a single character that either is or isn’t white space.

    Remember that an asterisk means 0 or more of a character, [\s\S]* works for any combination of characters and new lines up to the G: field.

    Putting it together, we get:

    C:.*McQuillen[\s\S]*R:.*March — or to be cautious, C:.*McQuillen[\s\S]*R:.*[Mm]arch which would work whether or not the word "March" is capitalized.

    Combining it with a URL, we get:*McQuillen[\s\S]*R:.*[Mm]arch

    If you put that into the URL field of your browser it should bring up April's March, Deanna's March, Neil Vincent Orzechowski's Welcome To Earth and Pete's March.

  • Hyperlinks & Field Order

    A Couple Other Search Topics

    There are other ways to do the search besides pasting it into the address bar of your browser. Most word processors are capable of handling links of this sort, as are many other programs.

    A New Search

    Let’s suppose we want to find all the tunes by Andy De Jarlis in the key of D. First let’s get the search phrase. It will be very similar to the one in the previous section. Here are a couple considerations:

    Andy’s last name has been spelled differently on different recordings: De Jarlis, deJarlis, DeJarlis, etc. The constant part is “Jarlis” so we’ll use that for the search.

    The key field is K:. The key should always be the last field before the tune begins according to the abc Standard. When searching for the key field really the only time there should be anything between K: and the key in question would be if someone added a space (e.g. K: D. Therefore we might change the search to K:\WD where \W only matches non-word characters. That would make it so K: Bb % Usually in D wouldn’t be incorrectly considered a match.

    With that in mind, our search will be:


    If we want to paste it into the browser address bar, we could use:*Jarlis[\s\S]*K:\W*D

    That will give us several tunes: Ti-Jean Bouribale, and two versions each of Manitoba’s Golden Boy and the Sleeping Giant Two-Step.

    As a Hyperlink

    We could also turn it into a hyperlink that we could click on from a web page, or from a word processor. Here is the form of such a hyperlink:

    <a href="*Jarlis[\s\S]*K:\W*D"> Andy De Jarlis Tunes in D </a>

    That would show up as a link: Andy De Jarlis Tunes in D — try it! It's set up to open in a new tab.

    Field Order & the Search

    The examples I have used are pretty unambiguous: composer generally comes near the beginning, and key or tune type near or at the end of the information fields in an abc tune.

    I use the N: (Notes) field in one place to store tune tags (as seen in the Tune Tags column of the Tune Index). Suppose we wanted to find all reels associated with New Hampshire. We could use R: or G: for Reels, and N: for New Hampshire. But which comes first? If you get it wrong, the search won’t work.

    Assuming N: was first, a good search would be:


    But if G: came first we’d have to reverse them. Rather than take a chance, we can include both possibilities in our search. If we want either one string of characters or another we can use the vertical bar. So ab|ba would match either ab or ba.

    Let’s try the following:


    Here's the search as part of a URL:*Hampshire[\s\S]*G:.*[rR]eel|G:.*[rR]eel[\s\S]*N:.*Hampshire

    And as a link:

    New Hampshire Reels in both orders

    And if you click on it you should get a new tab with a number of reels either written by someone from New Hampshire or associated with New Hampshire.